1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

avfilter/af_anequalizer: Fix memleak when inserting pad fails

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.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit fdbd579fd10bc80c0f4e5a86497a4aa2e00317c5)
This commit is contained in:
Andreas Rheinhardt 2020-08-22 03:23:51 +02:00
parent 7316177a44
commit 07fb367737

View File

@ -199,18 +199,6 @@ static av_cold int init(AVFilterContext *ctx)
if (!pad.name) if (!pad.name)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (s->draw_curves) {
vpad = (AVFilterPad){
.name = av_strdup("out1"),
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_video,
};
if (!vpad.name) {
av_freep(&pad.name);
return AVERROR(ENOMEM);
}
}
ret = ff_insert_outpad(ctx, 0, &pad); ret = ff_insert_outpad(ctx, 0, &pad);
if (ret < 0) { if (ret < 0) {
av_freep(&pad.name); av_freep(&pad.name);
@ -218,6 +206,14 @@ static av_cold int init(AVFilterContext *ctx)
} }
if (s->draw_curves) { if (s->draw_curves) {
vpad = (AVFilterPad){
.name = av_strdup("out1"),
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_video,
};
if (!vpad.name) {
return AVERROR(ENOMEM);
}
ret = ff_insert_outpad(ctx, 1, &vpad); ret = ff_insert_outpad(ctx, 1, &vpad);
if (ret < 0) { if (ret < 0) {
av_freep(&vpad.name); av_freep(&vpad.name);