aboutsummaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer2015-07-14 15:49:41 +0200
committerMichael Niedermayer2015-07-14 15:59:11 +0200
commit6e80fe1ecd984a59bb6c73cbb436cc06536b7728 (patch)
treec9a30bd1c61fb320a9602c1c9db9ebb687b048fc /ffmpeg.c
parent15629129dde771446a005282ee33c4ea1199e696 (diff)
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@niedermayer.cc>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index cb5018704d..844034e7e7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -500,7 +500,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);