[FFmpeg-devel] [PATCH 32/36] avcodec/mpegvideo: Remove always-false check

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Dec 24 05:23:28 EET 2021


An AVCodecContext's private data is always allocated
in avcodec_open2() and calling avcodec_flush_buffers()
on an unopened AVCodecContext (or an already closed one)
is not allowed (and will crash before the decoder's flush
function is even called).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/mpegvideo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c0ba91e864..942952e46b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2318,7 +2318,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){
     int i;
     MpegEncContext *s = avctx->priv_data;
 
-    if (!s || !s->picture)
+    if (!s->picture)
         return;
 
     for (i = 0; i < MAX_PICTURE_COUNT; i++)
-- 
2.32.0



More information about the ffmpeg-devel mailing list