[FFmpeg-cvslog] lavfi: clean memory on error in ADD_FORMAT()

Vittorio Giovara git at videolan.org
Fri Nov 21 22:25:09 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Nov 17 00:22:20 2014 +0100| [863ee8a855b8ce27ffef41479eb66da58763faed] | committer: Vittorio Giovara

lavfi: clean memory on error in ADD_FORMAT()

CC: libav-stable at libav.org
Bug-Id: CID 1250334

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 24a4fab..ea61ed2 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -188,8 +188,10 @@ do {                                                        \
                                                             \
     fmts = av_realloc((*f)->list,                           \
                       sizeof(*(*f)->list) * ((*f)->nb + 1));\
-    if (!fmts)                                              \
+    if (!fmts) {                                            \
+        av_freep(&f);                                       \
         return AVERROR(ENOMEM);                             \
+    }                                                       \
                                                             \
     (*f)->list = fmts;                                      \
     (*f)->list[(*f)->nb++] = fmt;                           \



More information about the ffmpeg-cvslog mailing list