diff options
author | Nikias Bassen | 2022-01-31 23:53:50 +0100 |
---|---|---|
committer | Nikias Bassen | 2022-01-31 23:53:50 +0100 |
commit | db4635a081b03eb9a2ea310bfb2f994fd9d4ee94 (patch) | |
tree | 272814b02879f2fd18df540b461ff1f3034c2df5 | |
parent | 6fcecd0226ee25e69ce049c4eba10933a0a2e944 (diff) | |
download | libplist-db4635a081b03eb9a2ea310bfb2f994fd9d4ee94.tar.gz libplist-db4635a081b03eb9a2ea310bfb2f994fd9d4ee94.tar.bz2 |
jplist: Fix memory leak that occurs when JSON parsing fails
Credit to OSS-Fuzz
-rw-r--r-- | fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984 | 1 | ||||
-rw-r--r-- | src/jplist.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984 b/fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984 new file mode 100644 index 0000000..a1f85f7 --- /dev/null +++ b/fuzz/jplist-leaks/clusterfuzz-testcase-minimized-jplist_fuzzer-5069883912617984 @@ -0,0 +1 @@ +{""A}
\ No newline at end of file diff --git a/src/jplist.c b/src/jplist.c index 827b367..65eb528 100644 --- a/src/jplist.c +++ b/src/jplist.c @@ -663,6 +663,7 @@ static plist_t parse_object(const char* js, jsmntok_info_t* ti, int* index) if (val) { plist_dict_set_item(obj, key, val); } else { + free(key); plist_free(obj); return NULL; } |