diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-11-07 16:52:48 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-11-18 21:02:52 +0000 |
commit | d6fbfb276ce89ad40f47784300fb99cee9d4aac9 (patch) | |
tree | 83720a7c5b0e209c20e49153d28b54e61ba3bdae /lib/fuzzing | |
parent | 43bc0b2c763284ec63ca1e750602f6a9b354f9ae (diff) | |
download | samba-d6fbfb276ce89ad40f47784300fb99cee9d4aac9.tar.gz |
lib/fuzzing: Free memory after successful load in fuzz_tiniparser
Otherwise we have a memory leak and so fail the Google oss-fuzz check_build test.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov 18 21:02:52 UTC 2019 on sn-devel-184
Diffstat (limited to 'lib/fuzzing')
-rw-r--r-- | lib/fuzzing/fuzz_tiniparser.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/fuzzing/fuzz_tiniparser.c b/lib/fuzzing/fuzz_tiniparser.c index ccc50da183a..6908f1815d7 100644 --- a/lib/fuzzing/fuzz_tiniparser.c +++ b/lib/fuzzing/fuzz_tiniparser.c @@ -28,6 +28,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) { FILE *fp = NULL; + struct tiniparser_dictionary *d = NULL; if (len == 0) { /* @@ -39,7 +40,10 @@ int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) fp = fmemopen(buf, len, "r"); - tiniparser_load_stream(fp); + d = tiniparser_load_stream(fp); + if (d != NULL) { + tiniparser_freedict(d); + } fclose(fp); |