From 991ba3fbac510690f335ba4db62e39ca6f7769b8 Mon Sep 17 00:00:00 2001 From: hajin-chung Date: Tue, 16 Sep 2025 17:13:01 +0900 Subject: [PATCH] avcodec/qsvdec: fix refcount leak in two-stage QSV init The temporary hw_frames_ctx created for header parsing was not being fully released, leading to a leak. Explicitly unreference the temporary context after use to resolve the leak. Signed-off-by: hajin-chung --- libavcodec/qsvdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 144cf5b9e9..a85c1785cf 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -202,6 +202,7 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses MFXClose(q->internal_qs.session); q->internal_qs.session = NULL; } + av_refstruct_unref(&q->frames_ctx.mids); av_buffer_unref(&q->frames_ctx.hw_frames_ctx); q->frames_ctx.hw_frames_ctx = av_buffer_ref(hw_frames_ref);