Message ID | 20200825140927.16433-2-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | fdbd579fd10bc80c0f4e5a86497a4aa2e00317c5 |
Headers | show |
Series | [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > It has been forgotten to free the name of the second outpad if attaching > the first one to the AVFilterContext fails. Fixing this is easy: Only > prepare the second outpad after (and if) the first outpad has been > successfully attached to the AVFilterContext. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/af_anequalizer.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > LGTM > diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c > index 177e1c7b39..26cf835727 100644 > --- a/libavfilter/af_anequalizer.c > +++ b/libavfilter/af_anequalizer.c > @@ -199,6 +199,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->draw_curves) { > vpad = (AVFilterPad){ > .name = av_strdup("out1"), > @@ -206,18 +212,8 @@ static av_cold int init(AVFilterContext *ctx) > .config_props = config_video, > }; > if (!vpad.name) { > - av_freep(&pad.name); > return AVERROR(ENOMEM); > } > - } > - > - ret = ff_insert_outpad(ctx, 0, &pad); > - if (ret < 0) { > - av_freep(&pad.name); > - return ret; > - } > - > - if (s->draw_curves) { > ret = ff_insert_outpad(ctx, 1, &vpad); > if (ret < 0) { > av_freep(&vpad.name); > -- > 2.20.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".
diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c index 177e1c7b39..26cf835727 100644 --- a/libavfilter/af_anequalizer.c +++ b/libavfilter/af_anequalizer.c @@ -199,6 +199,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->draw_curves) { vpad = (AVFilterPad){ .name = av_strdup("out1"), @@ -206,18 +212,8 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; if (!vpad.name) { - av_freep(&pad.name); return AVERROR(ENOMEM); } - } - - ret = ff_insert_outpad(ctx, 0, &pad); - if (ret < 0) { - av_freep(&pad.name); - return ret; - } - - if (s->draw_curves) { ret = ff_insert_outpad(ctx, 1, &vpad); if (ret < 0) { av_freep(&vpad.name);
It has been forgotten to free the name of the second outpad if attaching the first one to the AVFilterContext fails. Fixing this is easy: Only prepare the second outpad after (and if) the first outpad has been successfully attached to the AVFilterContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/af_anequalizer.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)