]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/afir: fix vpad.name leak
authorJun Zhao <barryjzhao@tencent.com>
Mon, 25 May 2020 00:48:12 +0000 (08:48 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Sat, 30 May 2020 11:02:34 +0000 (19:02 +0800)
Fix vpad.name leak in error path, move the vpad related operation
only if enabled show IR frequency response.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavfilter/af_afir.c

index 7c7e8458d4d8f344a304d28cb70413be32af1081..5ba880f10b8c6244562cb6a5b0de8162d37e1eda 100644 (file)
@@ -876,6 +876,12 @@ static av_cold int init(AVFilterContext *ctx)
     if (!pad.name)
         return AVERROR(ENOMEM);
 
+    ret = ff_insert_outpad(ctx, 0, &pad);
+    if (ret < 0) {
+        av_freep(&pad.name);
+        return ret;
+    }
+
     if (s->response) {
         vpad = (AVFilterPad){
             .name         = av_strdup("filter_response"),
@@ -884,15 +890,7 @@ static av_cold int init(AVFilterContext *ctx)
         };
         if (!vpad.name)
             return AVERROR(ENOMEM);
-    }
 
-    ret = ff_insert_outpad(ctx, 0, &pad);
-    if (ret < 0) {
-        av_freep(&pad.name);
-        return ret;
-    }
-
-    if (s->response) {
         ret = ff_insert_outpad(ctx, 1, &vpad);
         if (ret < 0) {
             av_freep(&vpad.name);