avfilter/af_surround: Check return value of av_tx_init()

Should fix Coverity issue #1516766.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-11-09 16:20:29 +01:00
parent b653352bd8
commit b6fcf3a617

View File

@ -194,7 +194,7 @@ static int config_input(AVFilterLink *inlink)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
AudioSurroundContext *s = ctx->priv; AudioSurroundContext *s = ctx->priv;
int ch; int ch, ret;
s->rdft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->rdft)); s->rdft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->rdft));
if (!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++) { for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
float scale = 1.f; float scale = 1.f;
av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT, 0, s->buf_size, &scale, 0); ret = av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT,
if (!s->rdft[ch]) 0, s->buf_size, &scale, 0);
return AVERROR(ENOMEM); if (ret < 0)
return ret;
} }
s->input_levels = av_malloc_array(s->nb_in_channels, sizeof(*s->input_levels)); s->input_levels = av_malloc_array(s->nb_in_channels, sizeof(*s->input_levels));
if (!s->input_levels) if (!s->input_levels)
@ -263,7 +264,7 @@ static int config_output(AVFilterLink *outlink)
{ {
AVFilterContext *ctx = outlink->src; AVFilterContext *ctx = outlink->src;
AudioSurroundContext *s = ctx->priv; AudioSurroundContext *s = ctx->priv;
int ch; int ch, ret;
s->irdft = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->irdft)); s->irdft = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->irdft));
if (!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++) { for (ch = 0; ch < outlink->ch_layout.nb_channels; ch++) {
float iscale = 1.f; float iscale = 1.f;
av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT, 1, s->buf_size, &iscale, 0); ret = av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT,
if (!s->irdft[ch]) 1, s->buf_size, &iscale, 0);
return AVERROR(ENOMEM); if (ret < 0)
return ret;
} }
s->output_levels = av_malloc_array(s->nb_out_channels, sizeof(*s->output_levels)); s->output_levels = av_malloc_array(s->nb_out_channels, sizeof(*s->output_levels));
if (!s->output_levels) if (!s->output_levels)