[libav-commits] vf_fps: fix a memleak on malloc failure.

Anton Khirnov git at libav.org
Sun Jul 22 09:22:22 CEST 2012


Module: libav
Branch: master
Commit: d515e9c2259dd825b167a94266efd5336a711702

Author:    Anton Khirnov <anton at khirnov.net>
Committer: Anton Khirnov <anton at khirnov.net>
Date:      Sun Jul 15 09:50:49 2012 +0200

vf_fps: fix a memleak on malloc failure.

---

 libavfilter/vf_fps.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index ab7cba5..bf140f8 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -161,8 +161,10 @@ static int write_to_fifo(AVFifoBuffer *fifo, AVFilterBufferRef *buf)
     int ret;
 
     if (!av_fifo_space(fifo) &&
-        (ret = av_fifo_realloc2(fifo, 2*av_fifo_size(fifo))))
+        (ret = av_fifo_realloc2(fifo, 2*av_fifo_size(fifo)))) {
+        avfilter_unref_bufferp(&buf);
         return ret;
+    }
 
     av_fifo_generic_write(fifo, &buf, sizeof(buf), NULL);
     return 0;



More information about the libav-commits mailing list