Calling qsv_decode_flush() results in qsv_decode_init_context() being called again during the next decoding cycle. If q->pool has already been created, this causes a memory leak because new memory is allocated to q->pool without cleaning up the existing memory through av_buffer_pool_uninit(). If q->pool already exists, we can simply reuse it, avoiding further memory allocation and potential leaks.
Signed-off-by: Hyunho Kim <[email protected]> --- libavcodec/qsvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 039ba62484..8a17a52da8 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -412,7 +412,7 @@ static int qsv_decode_init_context(AVCodecContext *avctx, QSVContext *q, mfxVide q->frame_info = param->mfx.FrameInfo; - if (!avctx->hw_frames_ctx) { + if (!avctx->hw_frames_ctx && !q->pool) { 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; -- 2.48.1.windows.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
