diff mbox

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

Message ID 1568115568-14548-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 44b55a8c9c87cd54b404dbf0b1d716eeec5357e6
Headers show

Commit Message

Jun Zhao Sept. 10, 2019, 11:39 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

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

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

Comments

Paul B Mahol Sept. 10, 2019, 1:05 p.m. UTC | #1
lgtm

On 9/10/19, Jun Zhao <mypopydev@gmail.com> wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
>
> free the pad.name in error handling path to avoid memory leak.
>
> Signed-off-by: Jun Zhao <barryjzhao@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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Jun Zhao Sept. 11, 2019, 2:32 a.m. UTC | #2
On Tue, Sep 10, 2019 at 9:06 PM Paul B Mahol <onemda@gmail.com> wrote:
>
> lgtm
>
Will apply, Thanks
diff mbox

Patch

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);