]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix memory leak on zero-length input on fuzz_http.c
authorNick Mathewson <nickm@torproject.org>
Wed, 11 Jan 2017 18:24:48 +0000 (13:24 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 30 Jan 2017 13:37:27 +0000 (08:37 -0500)
src/test/fuzz/fuzz_http.c

index f069900a2c284afd474568019ff0a07e7138d927..caad0b2f0215a4eb693fb31a77ea5c038d9b202d 100644 (file)
@@ -107,7 +107,7 @@ fuzz_main(const uint8_t *stdin_buf, size_t data_size)
   dir_conn.base_.inbuf = buf_new_with_data((char*)stdin_buf, data_size);
   if (!dir_conn.base_.inbuf) {
     log_debug(LD_GENERAL, "Zero-Length-Input\n");
-    return 0;
+    goto done;
   }
 
   /* Parse the headers */
@@ -122,6 +122,7 @@ fuzz_main(const uint8_t *stdin_buf, size_t data_size)
 
   log_debug(LD_GENERAL, "Result:\n%d\n", rv);
 
+ done:
   /* Reset. */
   tor_free(dir_conn.base_.address);
   buf_free(dir_conn.base_.inbuf);