[FFmpeg-devel,3/5] avcodec/flashsv: add FF_CODEC_CAP_INIT_CLEANUP to flashsv1

Submitted by Michael Niedermayer on July 7, 2019, 1:18 p.m.

Details

Message ID 20190707131814.24504-3-michael@niedermayer.cc
State Accepted
Commit 76af425159cfa0c09b85d5c763ffa9942c940bfc
Headers show

Commit Message

Michael Niedermayer July 7, 2019, 1:18 p.m.
Fixes: memleaks on error paths during init
Fixes: 15533/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV_fuzzer-5647977168764928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/flashsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer July 19, 2019, 4:19 p.m.
On Sun, Jul 07, 2019 at 03:18:12PM +0200, Michael Niedermayer wrote:
> Fixes: memleaks on error paths during init
> Fixes: 15533/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV_fuzzer-5647977168764928
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/flashsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 1dc3c710dc..45846bb3df 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -132,7 +132,6 @@  static av_cold int flashsv_decode_init(AVCodecContext *avctx)
 
     s->frame = av_frame_alloc();
     if (!s->frame) {
-        flashsv_decode_end(avctx);
         return AVERROR(ENOMEM);
     }
 
@@ -518,6 +517,7 @@  AVCodec ff_flashsv_decoder = {
     .close          = flashsv_decode_end,
     .decode         = flashsv_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
 };
 #endif /* CONFIG_FLASHSV_DECODER */