summaryrefslogtreecommitdiff
path: root/libavcodec/psymodel.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/psymodel.c')
-rw-r--r--libavcodec/psymodel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
index 6274a49ea9..2b5f111fbe 100644
--- a/libavcodec/psymodel.c
+++ b/libavcodec/psymodel.c
@@ -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);
}