From bfab87a61dde2084911d1f7d0e656912199219c8 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 9 Nov 2022 16:33:38 +0100 Subject: [PATCH] avfilter/vf_fftdnoiz: Check return value of av_tx_init() Should fix Coverity issue #1500329. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_fftdnoiz.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_fftdnoiz.c b/libavfilter/vf_fftdnoiz.c index e74f40b4cb..7b20ad367d 100644 --- a/libavfilter/vf_fftdnoiz.c +++ b/libavfilter/vf_fftdnoiz.c @@ -208,13 +208,17 @@ static int config_input(AVFilterLink *inlink) for (int i = 0; i < s->nb_threads; i++) { float scale = 1.f, iscale = 1.f; + int ret; - av_tx_init(&s->fft[i], &s->tx_fn, AV_TX_FLOAT_FFT, 0, s->block_size, &scale, 0); - av_tx_init(&s->ifft[i], &s->itx_fn, AV_TX_FLOAT_FFT, 1, s->block_size, &iscale, 0); - av_tx_init(&s->fft_r[i], &s->tx_r_fn, AV_TX_FLOAT_FFT, 0, 1 + s->nb_prev + s->nb_next, &scale, 0); - av_tx_init(&s->ifft_r[i], &s->itx_r_fn, AV_TX_FLOAT_FFT, 1, 1 + s->nb_prev + s->nb_next, &iscale, 0); - if (!s->fft[i] || !s->ifft[i] || !s->fft_r[i] || !s->ifft_r[i]) - return AVERROR(ENOMEM); + if ((ret = av_tx_init(&s->fft[i], &s->tx_fn, AV_TX_FLOAT_FFT, + 0, s->block_size, &scale, 0)) < 0 || + (ret = av_tx_init(&s->ifft[i], &s->itx_fn, AV_TX_FLOAT_FFT, + 1, s->block_size, &iscale, 0)) < 0 || + (ret = av_tx_init(&s->fft_r[i], &s->tx_r_fn, AV_TX_FLOAT_FFT, + 0, 1 + s->nb_prev + s->nb_next, &scale, 0)) < 0 || + (ret = av_tx_init(&s->ifft_r[i], &s->itx_r_fn, AV_TX_FLOAT_FFT, + 1, 1 + s->nb_prev + s->nb_next, &iscale, 0)) < 0) + return ret; } for (i = 0; i < s->nb_planes; i++) {