avfilter/vf_fftfilt: Check return value of av_tx_init()

Should fix Coverity issue #1516765.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-11-09 16:23:53 +01:00
parent b6fcf3a617
commit 36d0550bc9
1 changed files with 17 additions and 13 deletions

View File

@ -306,7 +306,7 @@ static int config_props(AVFilterLink *inlink)
{
FFTFILTContext *s = inlink->dst->priv;
const AVPixFmtDescriptor *desc;
int i, plane;
int ret, i, plane;
desc = av_pix_fmt_desc_get(inlink->format);
s->depth = desc->comp[0].depth;
@ -335,12 +335,14 @@ static int config_props(AVFilterLink *inlink)
for (int j = 0; j < s->nb_threads; j++) {
float scale = 1.f, iscale = 1.f;
av_tx_init(&s->hrdft[j][i], &s->htx_fn, AV_TX_FLOAT_RDFT, 0, 1 << s->rdft_hbits[i], &scale, 0);
if (!s->hrdft[j][i])
return AVERROR(ENOMEM);
av_tx_init(&s->ihrdft[j][i], &s->ihtx_fn, AV_TX_FLOAT_RDFT, 1, 1 << s->rdft_hbits[i], &iscale, 0);
if (!s->ihrdft[j][i])
return AVERROR(ENOMEM);
ret = av_tx_init(&s->hrdft[j][i], &s->htx_fn, AV_TX_FLOAT_RDFT,
0, 1 << s->rdft_hbits[i], &scale, 0);
if (ret < 0)
return ret;
ret = av_tx_init(&s->ihrdft[j][i], &s->ihtx_fn, AV_TX_FLOAT_RDFT,
1, 1 << s->rdft_hbits[i], &iscale, 0);
if (ret < 0)
return ret;
}
/* RDFT - Array initialization for Vertical pass*/
@ -356,12 +358,14 @@ static int config_props(AVFilterLink *inlink)
for (int j = 0; j < s->nb_threads; j++) {
float scale = 1.f, iscale = 1.f;
av_tx_init(&s->vrdft[j][i], &s->vtx_fn, AV_TX_FLOAT_RDFT, 0, 1 << s->rdft_vbits[i], &scale, 0);
if (!s->vrdft[j][i])
return AVERROR(ENOMEM);
av_tx_init(&s->ivrdft[j][i], &s->ivtx_fn, AV_TX_FLOAT_RDFT, 1, 1 << s->rdft_vbits[i], &iscale, 0);
if (!s->ivrdft[j][i])
return AVERROR(ENOMEM);
ret = av_tx_init(&s->vrdft[j][i], &s->vtx_fn, AV_TX_FLOAT_RDFT,
0, 1 << s->rdft_vbits[i], &scale, 0);
if (ret < 0)
return ret;
ret = av_tx_init(&s->ivrdft[j][i], &s->ivtx_fn, AV_TX_FLOAT_RDFT,
1, 1 << s->rdft_vbits[i], &iscale, 0);
if (ret < 0)
return ret;
}
}