avcodec/pngdec: Clean up on av_frame_ref() failure
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 17 Sep 2017 00:42:11 +0000 (02:42 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 20 Sep 2017 00:56:20 +0000 (02:56 +0200)
Fixes: memleak
Fixes: 3203/clusterfuzz-testcase-minimized-4514553595428864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pngdec.c

index dce8faf..0d6612c 100644 (file)
@@ -1414,7 +1414,7 @@ static int decode_frame_png(AVCodecContext *avctx,
     }
 
     if ((ret = av_frame_ref(data, s->picture.f)) < 0)
-        return ret;
+        goto the_end;
 
     *got_frame = 1;