[FFmpeg-devel] ffmpeg: Fix dereference before NULL check

Submitted by Michael Niedermayer on March 30, 2017, 4:57 p.m.

Details

Message ID 20170330165740.30561-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer March 30, 2017, 4:57 p.m.
Fixes CID1401675

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ffmpeg.c b/ffmpeg.c
index 11faf0d4a8..b11a6a1409 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1848,14 +1848,14 @@  static void flush_encoders(void)
         // Try to enable encoding with no input frames.
         // Maybe we should just let encoding fail instead.
         if (!ost->initialized) {
-            FilterGraph *fg = ost->filter->graph;
             char error[1024] = "";
 
             av_log(NULL, AV_LOG_WARNING,
                    "Finishing stream %d:%d without any data written to it.\n",
                    ost->file_index, ost->st->index);
 
-            if (ost->filter && !fg->graph) {
+            if (ost->filter && !ost->filter->graph->graph) {
+                FilterGraph *fg = ost->filter->graph;
                 int x;
                 for (x = 0; x < fg->nb_inputs; x++) {
                     InputFilter *ifilter = fg->inputs[x];