libavdevice/lavfi: check avfilter_graph_dump return value
authorZhao Zhili <zhilizhao@tencent.com>
Thu, 21 Nov 2019 07:08:18 +0000 (15:08 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 29 Nov 2019 18:58:35 +0000 (19:58 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavdevice/lavfi.c

index ca8f05f..c949ff7 100644 (file)
@@ -302,9 +302,13 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 
     if (lavfi->dump_graph) {
         char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph);
-        fputs(dump, stderr);
-        fflush(stderr);
-        av_free(dump);
+        if (dump != NULL) {
+            fputs(dump, stderr);
+            fflush(stderr);
+            av_free(dump);
+        } else {
+            FAIL(AVERROR(ENOMEM));
+        }
     }
 
     /* fill each stream with the information in the corresponding sink */