aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-07 04:58:56 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-20 00:24:03 +0200
commit3a0f080ffa5185f45850f15e5e7b8cf997337bf7 (patch)
treef1ce7aac5c0b497fb512b0d6782255730c0264e9
parent1c7e55dd504245d71444fac1a73e5370cc76fede (diff)
downloadffmpeg-3a0f080ffa5185f45850f15e5e7b8cf997337bf7.tar.gz
avfilter/af_afir: Fix leak of AVFilterChannelLayout in case of error
If an error happens between the allocation of an AVFilterChannelLayout and its usage (which involves attaching said object to a more permanent object), the channel layout array leaks. This can simply be fixed by making sure that nothing is between the allocation and the aforementioned usage. Fixes Coverity issue #1250334. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavfilter/af_afir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index 5ba880f10b..6cbc7a00a1 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -742,14 +742,14 @@ static int query_formats(AVFilterContext *ctx)
} else {
AVFilterChannelLayouts *mono = NULL;
- ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO);
- if (ret)
- return ret;
-
if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->out_channel_layouts)) < 0)
return ret;
if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0)
return ret;
+
+ ret = ff_add_channel_layout(&mono, AV_CH_LAYOUT_MONO);
+ if (ret)
+ return ret;
for (int i = 1; i < ctx->nb_inputs; i++) {
if ((ret = ff_channel_layouts_ref(mono, &ctx->inputs[i]->out_channel_layouts)) < 0)
return ret;