[FFmpeg-devel,2/2] libavcodec/utils: Free threads on init failure

Submitted by Michael Niedermayer on Aug. 27, 2019, 9:21 p.m.

Details

Message ID 20190827212151.7506-2-michael@niedermayer.cc
State Accepted
Commit 61b055bed0968d60eb24a5080fb4ba2bcf73b753
Headers show

Commit Message

Michael Niedermayer Aug. 27, 2019, 9:21 p.m.
Fixes: Multiple memleaks
Fixes: ffmpeg-memory-leak

Found-by: Francis Provencher <francis@protekresearchlab.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/utils.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Sept. 15, 2019, 10:19 p.m.
On Tue, Aug 27, 2019 at 11:21:51PM +0200, Michael Niedermayer wrote:
> Fixes: Multiple memleaks
> Fixes: ffmpeg-memory-leak
> 
> Found-by: Francis Provencher <francis@protekresearchlab.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/utils.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply


[...]

Patch hide | download patch | download mbox

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