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

Wenbin Chen git at videolan.org
Mon Jan 24 04:22:17 EET 2022


ffmpeg | branch: master | Wenbin Chen <wenbin.chen-at-intel.com at ffmpeg.org> | Thu Jan 20 15:13:43 2022 +0800| [05ba0ffca9b4c28e08fdd8086218c0075537125c] | committer: Haihao Xiang

libavcodec/qsvenc: fix a memory leak problem

"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.

Reported-by: Mark Samuelson <Mark.Samuelson at sonicfoundry.com>
Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05ba0ffca9b4c28e08fdd8086218c0075537125c
---

 libavcodec/qsvenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 413e5ae8f6..acb82f321c 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1575,6 +1575,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;



More information about the ffmpeg-cvslog mailing list