about summary refs log tree commit diff
path: root/src/afl-fuzz-python.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-12-27 20:50:04 +0100
committerGitHub <noreply@github.com>2019-12-27 20:50:04 +0100
commit0fb68cbbfa53c349921aec0bdf837127898bd989 (patch)
tree8fc4eb97b5013af0ccc83ac68369bdbabb3ff4b3 /src/afl-fuzz-python.c
parent064cd3315c2c31a26eef5fd0f70d6fd2c77ef0f8 (diff)
parentcc3bf762ece81fb1007bc368f4bd604804afd095 (diff)
downloadafl++-0fb68cbbfa53c349921aec0bdf837127898bd989.tar.gz
Merge pull request #156 from n0pFlux/master
Fixed memory leak in afl-fuzz-python.c - trim_case_python.
Diffstat (limited to 'src/afl-fuzz-python.c')
-rw-r--r--src/afl-fuzz-python.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index 73fcd138..53935698 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -345,7 +345,10 @@ u8 trim_case_python(char** argv, struct queue_entry* q, u8* in_buf) {
     fault = run_target(argv, exec_tmout);
     ++trim_execs;
 
-    if (stop_soon || fault == FAULT_ERROR) goto abort_trimming;
+    if (stop_soon || fault == FAULT_ERROR) {
+        free(retbuf);
+        goto abort_trimming;
+    }
 
     cksum = hash32(trace_bits, MAP_SIZE, HASH_CONST);
 
@@ -381,6 +384,8 @@ u8 trim_case_python(char** argv, struct queue_entry* q, u8* in_buf) {
 
     }
 
+    free(retbuf);
+
     /* Since this can be slow, update the screen every now and then. */
 
     if (!(trim_exec++ % stats_update_freq)) show_stats();