Fix potential memory leak if duplicate keys exist in a JSON object.

This commit is contained in:
Jordan Bancino 2022-12-06 21:26:33 +00:00
parent 01a6d71101
commit d0c81a8136

View file

@ -947,7 +947,8 @@ JsonDecodeObject(JsonParserState * state)
goto error;
}
HashMapSet(obj, key, value);
/* If there's an existing value at this key, discard it. */
JsonValueFree(HashMapSet(obj, key, value));
JsonTokenSeek(state);
if (JsonExpect(state, TOKEN_OBJECT_CLOSE))