lavfi/avfiltergraph: add check before free the format
authorJun Zhao <barryjzhao@tencent.com>
Mon, 19 Aug 2019 05:22:34 +0000 (13:22 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Tue, 20 Aug 2019 02:06:17 +0000 (10:06 +0800)
ff_merge_samplerates will be deallocate a or b in some case, so
add a check before free the format.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavfilter/avfiltergraph.c

index a149f8f..2fe4f0b 100644 (file)
@@ -419,8 +419,10 @@ static int can_merge_formats(AVFilterFormats *a_arg,
         av_freep(&ret);
         return 1;
     } else {
-        av_freep(&a->formats);
-        av_freep(&b->formats);
+        if (a)
+            av_freep(&a->formats);
+        if (b)
+            av_freep(&b->formats);
         av_freep(&a);
         av_freep(&b);
         return 0;