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 01:09:18 +0000 (03:09 +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>
(cherry picked from commit 5480e82d77770e81e897a8c217f3c7f0c13a6de1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pngdec.c

index 986cde3..9b236a2 100644 (file)
@@ -888,7 +888,7 @@ exit_loop:
     metadata   = NULL;
 
     if ((ret = av_frame_ref(data, s->picture.f)) < 0)
-        return ret;
+        goto the_end;
 
     *got_frame = 1;