[FFmpeg-devel] [PATCH 4/7] avcodec/avcodec: Free frame_thread_encoder on avcodec_open2() error

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Apr 19 05:06:11 EEST 2021


The frame_thread_encoder has so far not been freed in case an error
happened in avcodec_open2() after ff_frame_thread_encoder_init().
This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/avcodec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 24f6922d4f..6cff596f6a 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -399,6 +399,8 @@ free_and_end:
          avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))
         avctx->codec->close(avctx);
 
+    if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
+        ff_frame_thread_encoder_free(avctx);
     if (HAVE_THREADS && avci->thread_ctx)
         ff_thread_free(avctx);
 
-- 
2.27.0



More information about the ffmpeg-devel mailing list