avfilter/avf_showspectrum: Fix allocation check

If s->stop is set, the return value would be overwritten
before being checked. This bug was introduced in the switch
to AV_TX in 014ace8f98.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2026-02-23 22:59:45 +01:00
parent c1be2107c9
commit 0992c19c30

View file

@ -1143,6 +1143,11 @@ static int config_output(AVFilterLink *outlink)
float scale = 1.f;
ret = av_tx_init(&s->fft[i], &s->tx_fn, AV_TX_FLOAT_FFT, 0, fft_size << (!!s->stop), &scale, 0);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
"The window size might be too high.\n");
return ret;
}
if (s->stop) {
ret = av_tx_init(&s->ifft[i], &s->itx_fn, AV_TX_FLOAT_FFT, 1, fft_size << (!!s->stop), &scale, 0);
if (ret < 0) {
@ -1151,11 +1156,6 @@ static int config_output(AVFilterLink *outlink)
return ret;
}
}
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
"The window size might be too high.\n");
return ret;
}
}
s->magnitudes = av_calloc(s->nb_display_channels, sizeof(*s->magnitudes));