]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/tiff: Set FF_CODEC_CAP_INIT_CLEANUP
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Oct 2019 19:14:17 +0000 (21:14 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Oct 2019 17:37:35 +0000 (19:37 +0200)
Fixes: memleaks
Fixes: 17813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5145600206569472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/tiff.c

index 9f24796a8865c02a5aea0f932d819ddcaf63f553..f537e99b5a81ae55c185a0cae3081818b2c8e456 100644 (file)
@@ -2090,8 +2090,6 @@ static av_cold int tiff_init(AVCodecContext *avctx)
     s->avctx_mjpeg->idct_algo = avctx->idct_algo;
     ret = ff_codec_open2_recursive(s->avctx_mjpeg, codec, NULL);
     if (ret < 0) {
-        av_frame_free(&s->jpgframe);
-        avcodec_free_context(&s->avctx_mjpeg);
         return ret;
     }
 
@@ -2142,5 +2140,6 @@ AVCodec ff_tiff_decoder = {
     .decode         = decode_frame,
     .init_thread_copy = ONLY_IF_THREADS_ENABLED(tiff_init),
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .priv_class     = &tiff_decoder_class,
 };