diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 33c2c36b83..4d6ed7777c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -991,6 +991,8 @@ int avcodec_close(AVCodecContext *avctx) return -1; } + if (ENABLE_THREADS && avctx->thread_opaque) + avcodec_thread_free(avctx); if (avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx);