Commit 94cafa1805 for ffmpeg
commit 94cafa1805620244885192f3d9d020e2a425099d
Author: Anton Kesy <anton.kesy@intel.com>
Date: Mon Nov 9 09:11:40 2026 +0100
avcodec/qsvdec: free the system memory pool on reinit
qsv_decode_init_context() runs again after a resolution or format
change and overwrote q->pool without releasing the old one. When
decoding to system memory (no hw_frames_ctx), every reinit leaked the
old pool and all buffers allocated from it.
Signed-off-by: Anton Kesy <anton.kesy@intel.com>
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 990e46ea1d..8e49314651 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -417,6 +417,7 @@ static int qsv_decode_init_context(AVCodecContext *avctx, QSVContext *q, mfxVide
ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->coded_width, 128), FFALIGN(avctx->coded_height, 64), 1);
if (ret < 0)
return ret;
+ av_buffer_pool_uninit(&q->pool);
q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
}
return 0;