aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_channelmap.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-07-02 20:13:40 +0200
committerAnton Khirnov <anton@khirnov.net>2012-07-09 08:25:19 +0200
commitcd99146253cf9de5dad5694b97027d5612fdc61d (patch)
tree0b53395aa59459574c2e5fa1c277b4267e01c4a0 /libavfilter/af_channelmap.c
parent8d18bc550e7dfc62bc872507a02ae2d7827882d6 (diff)
downloadffmpeg-cd99146253cf9de5dad5694b97027d5612fdc61d.tar.gz
lavfi: add error handling to filter_samples().
Diffstat (limited to 'libavfilter/af_channelmap.c')
-rw-r--r--libavfilter/af_channelmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 0dfffaa036..1d32d2a087 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -313,7 +313,7 @@ static int channelmap_query_formats(AVFilterContext *ctx)
return 0;
}
-static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
+static int channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
@@ -330,8 +330,10 @@ static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *b
if (nch_out > FF_ARRAY_ELEMS(buf->data)) {
uint8_t **new_extended_data =
av_mallocz(nch_out * sizeof(*buf->extended_data));
- if (!new_extended_data)
- return;
+ if (!new_extended_data) {
+ avfilter_unref_buffer(buf);
+ return AVERROR(ENOMEM);
+ }
if (buf->extended_data == buf->data) {
buf->extended_data = new_extended_data;
} else {
@@ -353,7 +355,7 @@ static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *b
memcpy(buf->data, buf->extended_data,
FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
- ff_filter_samples(outlink, buf);
+ return ff_filter_samples(outlink, buf);
}
static int channelmap_config_input(AVFilterLink *inlink)