[FFmpeg-devel] [PATCH] libavcodec/qsvenc: fix a memory leak problem

Xiang, Haihao haihao.xiang at intel.com
Fri Jan 21 03:08:15 EET 2022


On Thu, 2022-01-20 at 15:13 +0800, Wenbin Chen wrote:
> "qf->frame" ref to input frame but it isn't released. av_frame_unref()
> is added before refering qf->frame to new frame to make sure the previous
> reference is released.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
> ---
>  libavcodec/qsvenc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 269386624d..fd5c460d68 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1521,6 +1521,7 @@ static int submit_frame(QSVEncContext *q, const AVFrame
> *frame,
>                  return ret;
>              }
>          } else {
> +            av_frame_unref(qf->frame);
>              ret = av_frame_ref(qf->frame, frame);
>              if (ret < 0)
>                  return ret;

LGTM, will apply

-Haihao



More information about the ffmpeg-devel mailing list