diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-23 20:11:51 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-03 03:48:04 +0100 |
commit | 6559858de9a3c18bd5cf4892cb7b5b90180e7d97 (patch) | |
tree | a6bab9fba6cbcf9ed2c84ffca5bf8bb85ed3d789 /fftools | |
parent | 88b02e58299beaad0151d76a4377e90c39944c46 (diff) |
fftools/ffmpeg: Don't presume frame_queue to have been allocated
Fixes segfaults upon allocation failure.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools')
-rw-r--r-- | fftools/ffmpeg.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d5cd010a9c..9a3fdc636d 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -527,11 +527,13 @@ static void ffmpeg_cleanup(int ret) for (j = 0; j < fg->nb_inputs; j++) { InputFilter *ifilter = fg->inputs[j]; struct InputStream *ist = ifilter->ist; - AVFrame *frame; - while (av_fifo_read(ifilter->frame_queue, &frame, 1) >= 0) - av_frame_free(&frame); - av_fifo_freep2(&ifilter->frame_queue); + if (ifilter->frame_queue) { + AVFrame *frame; + while (av_fifo_read(ifilter->frame_queue, &frame, 1) >= 0) + av_frame_free(&frame); + av_fifo_freep2(&ifilter->frame_queue); + } av_freep(&ifilter->displaymatrix); if (ist->sub2video.sub_queue) { AVSubtitle sub; |