[FFmpeg-devel] [PATCH V1 1/4] lavfi/anequalizer: fix memory leak in error handling path

Jun Zhao mypopydev at gmail.com
Tue Sep 10 14:39:25 EEST 2019


From: Jun Zhao <barryjzhao at tencent.com>

free the pad.name in error handling path to avoid memory leak.

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 libavfilter/af_anequalizer.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
index 03d939f..ee82474 100644
--- a/libavfilter/af_anequalizer.c
+++ b/libavfilter/af_anequalizer.c
@@ -205,8 +205,10 @@ static av_cold int init(AVFilterContext *ctx)
             .type         = AVMEDIA_TYPE_VIDEO,
             .config_props = config_video,
         };
-        if (!vpad.name)
+        if (!vpad.name) {
+            av_freep(&pad.name);
             return AVERROR(ENOMEM);
+        }
     }
 
     ret = ff_insert_outpad(ctx, 0, &pad);
-- 
1.7.1



More information about the ffmpeg-devel mailing list