[FFmpeg-cvslog] avcodec/gif: Fix leaks upon allocation error

Andreas Rheinhardt git at videolan.org
Tue Sep 15 20:43:46 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Sep 14 17:30:34 2020 +0200| [8da8774d8eb1d5dec830f36d2e6b0ace1b16e2f5] | committer: Andreas Rheinhardt

avcodec/gif: Fix leaks upon allocation error

If one of several allocations the gif encoder performs in its init
function fails, the successful allocations leak. Fix this by adding the
FF_CODEC_CAP_INIT_CLEANUP flag.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8da8774d8eb1d5dec830f36d2e6b0ace1b16e2f5
---

 libavcodec/gif.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 65a76cfde4..de41992851 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -497,4 +497,5 @@ AVCodec ff_gif_encoder = {
         AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8, AV_PIX_FMT_NONE
     },
     .priv_class     = &gif_class,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };



More information about the ffmpeg-cvslog mailing list