diff mbox series

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

Message ID HE1PR0301MB21541FFE8B18E83D32B94F338F499@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit d07534b5f5f20b4f780f5b0284aca6354da00695
Headers show
Series [FFmpeg-devel,1/7] avcodec/avcodec: Actually honour the documentation of subtitle_header
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 19, 2021, 2:06 a.m. UTC
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@outlook.com>
---
 libavcodec/avcodec.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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);