diff options
author | Ganesh Ajjanagadde <gajjanag@gmail.com> | 2016-03-02 20:14:08 -0500 |
---|---|---|
committer | Ganesh Ajjanagadde <gajjanag@gmail.com> | 2016-03-23 08:22:22 -0700 |
commit | 8dbffda0f9401644467111c85090fa0e8091e08a (patch) | |
tree | 9223b1f6982971a72d730c9638b8728a3174762a | |
parent | b098e1a4697573d5c501aceb863d89ebf1fcd5fd (diff) | |
download | ffmpeg-8dbffda0f9401644467111c85090fa0e8091e08a.tar.gz |
lavc/psymodel: check for av_malloc failure
No idea why in commit 01ecb7172b684f1c4b3e748f95c5a9a494ca36ec the
checks were removed; this can lead to NULL pointer dereferences. This
effectively reverts that portion of the commit.
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanag@gmail.com>
-rw-r--r-- | libavcodec/psymodel.c | 7 |
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); } |