aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-24 22:21:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-26 23:52:57 +0200
commitca8e5dedc7fabae3df76ea11d9952070cbb19620 (patch)
tree3c09cfb26eb66f2c2d69370c04dcac6e4f09a66c /libavfilter
parent0960da42f5414a24497c75787ff4be318ae41421 (diff)
downloadffmpeg-ca8e5dedc7fabae3df76ea11d9952070cbb19620.tar.gz
avfilter/af_headphone: Fix leak of channel layouts list on error
In case the multichannel HRIR mode was enabled, an error could happen between allocating a channel layouts list and attaching it to its target destination. If an error happened, the list would leak. This is fixed by attaching the list to its target directly after its allocation. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_headphone.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 751f4ab53d..da5acdce30 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -705,6 +705,9 @@ static int query_formats(AVFilterContext *ctx)
ret = ff_add_channel_layout(&stereo_layout, AV_CH_LAYOUT_STEREO);
if (ret)
return ret;
+ ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->in_channel_layouts);
+ if (ret)
+ return ret;
if (s->hrir_fmt == HRIR_MULTI) {
hrir_layouts = ff_all_channel_counts();
@@ -721,10 +724,6 @@ static int query_formats(AVFilterContext *ctx)
}
}
- ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->in_channel_layouts);
- if (ret)
- return ret;
-
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);