[FFmpeg-cvslog] avcodec/magicyuvenc: Fix memleak upon init failure

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Sep 15 02:13:56 2020 +0200| [a8ebb5632018adad733f89fa4efe74d7e92155ac] | committer: Andreas Rheinhardt

avcodec/magicyuvenc: Fix memleak upon init failure

If an error happens during init after an allocation has succeeded,
the already allocated data leaked up until now. Fix this by setting 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=a8ebb5632018adad733f89fa4efe74d7e92155ac
---

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

diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index e9fe3bf519..0bd6b8ef6a 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -587,4 +587,5 @@ AVCodec ff_magicyuv_encoder = {
                           AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_GRAY8,
                           AV_PIX_FMT_NONE
                       },
+    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
 };



More information about the ffmpeg-cvslog mailing list