[FFmpeg-cvslog] avcodec/avrndec: Fix memleak on error

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Sep 13 22:05:25 2020 +0200| [3c2128df7ffdb32a3ef34044f9a4c2f15dc1776f] | committer: Andreas Rheinhardt

avcodec/avrndec: Fix memleak on error

If ff_codec_open2_recursive() fails, the already allocated
AVCodecContext leaks. 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=3c2128df7ffdb32a3ef34044f9a4c2f15dc1776f
---

 libavcodec/avrndec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index a4b6fadfc8..c5a60acd4f 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -170,5 +170,5 @@ AVCodec ff_avrn_decoder = {
     .close          = end,
     .decode         = decode_frame,
     .max_lowres     = 3,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
 };



More information about the ffmpeg-cvslog mailing list