tools/target_dec_fuzzer: Fix memleak on open failure
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 May 2017 11:31:02 +0000 (13:31 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 May 2017 11:51:50 +0000 (13:51 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tools/target_dec_fuzzer.c

index 19423e2..5a0b53e 100644 (file)
@@ -180,8 +180,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
     }
 
     int res = avcodec_open2(ctx, c, NULL);
-    if (res < 0)
+    if (res < 0) {
+        av_free(ctx);
         return 0; // Failure of avcodec_open2() does not imply that a issue was found
+    }
 
     FDBCreate(&buffer);
     int got_frame;