aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_amerge.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-09-11 06:41:55 +0200
committerClément Bœsch <ubitux@gmail.com>2012-09-11 14:59:23 +0200
commit7b56dddd565438e5c9a9bfcd0a55e087ce0800fe (patch)
tree6806559675892450605543f1aa418e6345447ab2 /libavfilter/af_amerge.c
parent20361bcc264031dfff8f75f6f03b935a37ecb116 (diff)
downloadffmpeg-7b56dddd565438e5c9a9bfcd0a55e087ce0800fe.tar.gz
lavfi/amerge: fix input pad name behaviour.
This fixes two problems: - the invalid pad.name stack pointer after init() ends - the duplicated name for all inputs
Diffstat (limited to 'libavfilter/af_amerge.c')
-rw-r--r--libavfilter/af_amerge.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 542f8a6fd6..1ff3c8ca98 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -24,6 +24,7 @@
*/
#include "libavutil/audioconvert.h"
+#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
#include "libswresample/swresample.h" // only for SWR_CH_MAX
@@ -61,8 +62,10 @@ static av_cold void uninit(AVFilterContext *ctx)
AMergeContext *am = ctx->priv;
int i;
- for (i = 0; i < am->nb_inputs; i++)
+ for (i = 0; i < am->nb_inputs; i++) {
ff_bufqueue_discard_all(&am->in[i].queue);
+ av_freep(&ctx->input_pads[i].name);
+ }
av_freep(&am->in);
}
@@ -293,7 +296,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
{
AMergeContext *am = ctx->priv;
int ret, i;
- char name[16];
am->class = &amerge_class;
av_opt_set_defaults(am);
@@ -306,13 +308,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if (!am->in)
return AVERROR(ENOMEM);
for (i = 0; i < am->nb_inputs; i++) {
+ char *name = av_asprintf("in%d", i);
+ if (!name)
+ return AVERROR(ENOMEM);
AVFilterPad pad = {
.name = name,
.type = AVMEDIA_TYPE_AUDIO,
.filter_samples = filter_samples,
.min_perms = AV_PERM_READ | AV_PERM_PRESERVE,
};
- snprintf(name, sizeof(name), "in%d", i);
ff_insert_inpad(ctx, i, &pad);
}
return 0;