Message ID | 1590394577-1502-1-git-send-email-mypopydev@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,v2,1/2] lavfi/afir: fix vpad.name leak | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Mon, May 25, 2020 at 4:17 PM Jun Zhao <mypopydev@gmail.com> wrote: > > From: Jun Zhao <barryjzhao@tencent.com> > > 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 | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c > index 7c7e845..5ba880f 100644 > --- a/libavfilter/af_afir.c > +++ b/libavfilter/af_afir.c > @@ -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); > -- > 2.7.4 > Ping ?
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 7c7e845..5ba880f 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -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);