]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/avrndec: Fix memleak on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 13 Sep 2020 20:05:25 +0000 (22:05 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 15 Sep 2020 17:25:26 +0000 (19:25 +0200)
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@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/avrndec.c

index a4b6fadfc84efb1f3aa5350cfc9a2418509d63f1..c5a60acd4fc282019bf1acc31c801fa5ebef59e8 100644 (file)
@@ -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,
 };