diff mbox

[FFmpeg-devel] libavdevice/lavfi: check avfilter_graph_dump return value

Message ID 20191121070818.25465-1-quinkblack@foxmail.com
State Accepted
Commit 19956d01ccf1aca2902e8192c8768903cee3be06
Headers show

Commit Message

Zhao Zhili Nov. 21, 2019, 7:08 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavdevice/lavfi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Zhao Zhili Nov. 29, 2019, 12:16 p.m. UTC | #1
Ping for review, thanks!

> On Nov 21, 2019, at 3:08 PM, quinkblack@foxmail.com wrote:
> 
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> ---
> libavdevice/lavfi.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
> index ca8f05f3f7..c949ff7e12 100644
> --- a/libavdevice/lavfi.c
> +++ b/libavdevice/lavfi.c
> @@ -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 */
> -- 
> 2.22.0
>
Michael Niedermayer Nov. 29, 2019, 6:40 p.m. UTC | #2
On Thu, Nov 21, 2019 at 03:08:18PM +0800, quinkblack@foxmail.com wrote:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> ---
>  libavdevice/lavfi.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index ca8f05f3f7..c949ff7e12 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -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 */