[FFmpeg-cvslog] ffmpeg: Fix cleanup after failed allocation of output_files

Michael Niedermayer git at videolan.org
Sat Jul 18 20:46:09 CEST 2015


ffmpeg | branch: release/2.7 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jul 14 15:49:41 2015 +0200| [2e7bd0f725c8124a3c040fce60e952d802925cdf] | committer: Michael Niedermayer

ffmpeg: Fix cleanup after failed allocation of output_files

Fixes: 39a25908b84604acdaa490138282d091_signal_sigsegv_7ffff713351a_331_WAWV.avi with memlimit of 262144

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 6e80fe1ecd984a59bb6c73cbb436cc06536b7728)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 ffmpeg.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 52aa967..ec67af3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -456,7 +456,10 @@ static void ffmpeg_cleanup(int ret)
     /* close files */
     for (i = 0; i < nb_output_files; i++) {
         OutputFile *of = output_files[i];
-        AVFormatContext *s = of->ctx;
+        AVFormatContext *s;
+        if (!of)
+            continue;
+        s = of->ctx;
         if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
             avio_closep(&s->pb);
         avformat_free_context(s);



More information about the ffmpeg-cvslog mailing list