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>
... | ... |
@@ -500,7 +500,10 @@ static void ffmpeg_cleanup(int ret) |
500 | 500 |
/* close files */ |
501 | 501 |
for (i = 0; i < nb_output_files; i++) { |
502 | 502 |
OutputFile *of = output_files[i]; |
503 |
- AVFormatContext *s = of->ctx; |
|
503 |
+ AVFormatContext *s; |
|
504 |
+ if (!of) |
|
505 |
+ continue; |
|
506 |
+ s = of->ctx; |
|
504 | 507 |
if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE)) |
505 | 508 |
avio_closep(&s->pb); |
506 | 509 |
avformat_free_context(s); |