diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 18f89ee73d..b16c1b9928 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -620,8 +620,11 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) av_freep(&p->avctx->slice_offset); } - if (p->avctx) + if (p->avctx) { av_freep(&p->avctx->internal); + av_buffer_unref(&p->avctx->hw_frames_ctx); + } + av_freep(&p->avctx); }