diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-11-09 16:20:29 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-11-12 13:24:35 +0100 |
commit | b6fcf3a617e5a78408a5f13f3552d7a2d8ed6051 (patch) | |
tree | 15cd9f4654dfbc94962c9d96eafd915cb174216a /libavfilter/af_surround.c | |
parent | b653352bd89fa0da3ea0377fad07e3979eecad47 (diff) |
avfilter/af_surround: Check return value of av_tx_init()
Should fix Coverity issue #1516766.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/af_surround.c')
-rw-r--r-- | libavfilter/af_surround.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index 858fed609a..e7bcb2e585 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -194,7 +194,7 @@ static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; AudioSurroundContext *s = ctx->priv; - int ch; + int ch, ret; s->rdft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->rdft)); if (!s->rdft) @@ -204,9 +204,10 @@ static int config_input(AVFilterLink *inlink) for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) { float scale = 1.f; - av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT, 0, s->buf_size, &scale, 0); - if (!s->rdft[ch]) - return AVERROR(ENOMEM); + ret = av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT, + 0, s->buf_size, &scale, 0); + if (ret < 0) + return ret; } s->input_levels = av_malloc_array(s->nb_in_channels, sizeof(*s->input_levels)); if (!s->input_levels) @@ -263,7 +264,7 @@ static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; AudioSurroundContext *s = ctx->priv; - int ch; + int ch, ret; s->irdft = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->irdft)); if (!s->irdft) @@ -273,9 +274,10 @@ static int config_output(AVFilterLink *outlink) for (ch = 0; ch < outlink->ch_layout.nb_channels; ch++) { float iscale = 1.f; - av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT, 1, s->buf_size, &iscale, 0); - if (!s->irdft[ch]) - return AVERROR(ENOMEM); + ret = av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT, + 1, s->buf_size, &iscale, 0); + if (ret < 0) + return ret; } s->output_levels = av_malloc_array(s->nb_out_channels, sizeof(*s->output_levels)); if (!s->output_levels) |