Module: libav
Branch: master
Commit: 22522d9c2c69624fe4d81d61ee65a56610f22f1d

Author:    Anton Khirnov <[email protected]>
Committer: Anton Khirnov <[email protected]>
Date:      Tue Jul 21 19:41:59 2015 +0200

qsvdec: fix a memleak of async_fifo

init() is called whenever format changes, so current code would leak the
fifo in this case.

---

 libavcodec/qsvdec.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 489375c..ef781d9 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -73,10 +73,12 @@ int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext 
*q, mfxSession session)
     mfxVideoParam param = { { 0 } };
     int ret;
 
-    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
-                                  (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));
-    if (!q->async_fifo)
-        return AVERROR(ENOMEM);
+    if (!q->async_fifo) {
+        q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
+                                      (sizeof(mfxSyncPoint) + 
sizeof(QSVFrame*)));
+        if (!q->async_fifo)
+            return AVERROR(ENOMEM);
+    }
 
     ret = qsv_init_session(avctx, q, session);
     if (ret < 0) {

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to