Commit 8dbffda0 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

lavc/psymodel: check for av_malloc failure

No idea why in commit 01ecb717 the
checks were removed; this can lead to NULL pointer dereferences. This
effectively reverts that portion of the commit.
Reviewed-by: 's avatarBenoit Fouet <benoit.fouet@free.fr>
Reviewed-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanag@gmail.com>
parent b098e1a4
......@@ -120,7 +120,12 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
FF_FILTER_MODE_LOWPASS, FILT_ORDER,
cutoff_coeff, 0.0, 0.0);
if (ctx->fcoeffs) {
ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels);
ctx->fstate = av_mallocz_array(sizeof(ctx->fstate[0]), avctx->channels);
if (!ctx->fstate) {
av_free(ctx->fcoeffs);
av_free(ctx);
return NULL;
}
for (i = 0; i < avctx->channels; i++)
ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment