qsvdec: Fix memory leak on error
authorTimothy Gu <timothygu99@gmail.com>
Mon, 5 Dec 2016 18:21:11 +0000 (10:21 -0800)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Thu, 8 Dec 2016 20:53:58 +0000 (15:53 -0500)
Bug-Id: CID 1396851
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/qsvdec.c

index b6fead0..b83b0fc 100644 (file)
@@ -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);