From fb215798c7a72b32e889b72efd018f26bb3f88ce Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 8 Oct 2021 09:47:33 +0200 Subject: fftools/ffmpeg: Fix crash when flushing non-fully setup output stream The output stream's packet may not have been allocated at that point. This happens when quitting in the following command line: $ ./ffmpeg -lavfi abuffer=sample_fmt=u8:sample_rate=48000:channel_layout=stereo -f null - Reviewed-by: Paul B Mahol Signed-off-by: Andreas Rheinhardt --- fftools/ffmpeg.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fftools') diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index bb29e3cec5..0e38d6d185 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1981,6 +1981,9 @@ static void flush_encoders(void) AVPacket *pkt = ost->pkt; int pkt_size; + if (!pkt) + break; + switch (enc->codec_type) { case AVMEDIA_TYPE_AUDIO: desc = "audio"; -- cgit v1.2.3