avformat/mpegenc: check for stream private data during deinit
authorJames Almer <jamrial@gmail.com>
Sat, 19 Oct 2019 02:14:21 +0000 (23:14 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 19 Oct 2019 02:14:40 +0000 (23:14 -0300)
Prevents pointer dereferences when streams were not fully initialized.

Signed-off-by: James Almer <jamrial@gmail.com>
libavformat/mpegenc.c

index 93f40b2..f698023 100644 (file)
@@ -1258,6 +1258,8 @@ static void mpeg_mux_deinit(AVFormatContext *ctx)
 {
     for (int i = 0; i < ctx->nb_streams; i++) {
         StreamInfo *stream = ctx->streams[i]->priv_data;
+        if (!stream)
+            continue;
         av_fifo_freep(&stream->fifo);
     }
 }