Browse Source

Fix memory leak on zero-length input on fuzz_http.c

Nick Mathewson 7 years ago
parent
commit
1d8e9e8c69
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/test/fuzz/fuzz_http.c

+ 2 - 1
src/test/fuzz/fuzz_http.c

@@ -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);