[FFmpeg-cvslog] libavcodec/utils: Free threads on init failure

Michael Niedermayer git at videolan.org
Mon Sep 16 02:00:12 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Aug 27 17:21:00 2019 +0200| [61b055bed0968d60eb24a5080fb4ba2bcf73b753] | committer: Michael Niedermayer

libavcodec/utils: Free threads on init failure

Fixes: Multiple memleaks
Fixes: ffmpeg-memory-leak

Found-by: Francis Provencher <francis at protekresearchlab.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61b055bed0968d60eb24a5080fb4ba2bcf73b753
---

 libavcodec/utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a6a646636d..729c10a8ed 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1029,6 +1029,9 @@ free_and_end:
          (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))
         avctx->codec->close(avctx);
 
+    if (HAVE_THREADS && avctx->internal->thread_ctx)
+        ff_thread_free(avctx);
+
     if (codec->priv_class && codec->priv_data_size)
         av_opt_free(avctx->priv_data);
     av_opt_free(avctx);



More information about the ffmpeg-cvslog mailing list