[FFmpeg-cvslog] qsvdec: Fix memory leak on error

Timothy Gu git at videolan.org
Fri Apr 14 00:30:40 EEST 2017


ffmpeg | branch: master | Timothy Gu <timothygu99 at gmail.com> | Mon Dec  5 10:21:11 2016 -0800| [d32bdadda86b35c2960e4de877cf081b9d2dadb3] | committer: Vittorio Giovara

qsvdec: Fix memory leak on error

Bug-Id: CID 1396851
Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

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

 libavcodec/qsvdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index b6fead0b84..b83b0fcda8 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -306,8 +306,10 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
 
     do {
         ret = get_surface(avctx, q, &insurf);
-        if (ret < 0)
+        if (ret < 0) {
+            av_freep(&sync);
             return ret;
+        }
 
         ret = MFXVideoDECODE_DecodeFrameAsync(q->session, avpkt->size ? &bs : NULL,
                                               insurf, &outsurf, sync);



More information about the ffmpeg-cvslog mailing list