diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-03 20:30:33 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-05 13:27:38 +0100 |
commit | b886512ef2503fc585c302484be71475d3100480 (patch) | |
tree | a86810192d46f5c0fd692aaf8cce0b9dae863ebf /fftools/ffmpeg_opt.c | |
parent | 2d0bfbd0fafe5e869919120758903801f91530fa (diff) |
fftools/ffmpeg: Avoid allocating+freeing frame, check allocations
Fixes a potential crash upon av_frame_alloc() failure.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r-- | fftools/ffmpeg_opt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index eea57a6974..a703798586 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1905,6 +1905,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) exit_program(1); + + ost->last_frame = av_frame_alloc(); + if (!ost->last_frame) + exit_program(1); } else { MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st); } |