[FFmpeg-cvslog] lavfi/avfiltergraph: add check before free the format

Jun Zhao git at videolan.org
Tue Aug 20 05:10:50 EEST 2019


ffmpeg | branch: master | Jun Zhao <barryjzhao at tencent.com> | Mon Aug 19 13:22:34 2019 +0800| [f156f4ab2317f22bfef33c7eaead0d5d5f162903] | committer: Jun Zhao

lavfi/avfiltergraph: add check before free the format

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 at gmail.com>
Signed-off-by: Jun Zhao <barryjzhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f156f4ab2317f22bfef33c7eaead0d5d5f162903
---

 libavfilter/avfiltergraph.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index a149f8fb6d..2fe4f0b0f9 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -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;



More information about the ffmpeg-cvslog mailing list