[FFmpeg-cvslog] aacpsy: Check memory allocation
Vittorio Giovara
git at videolan.org
Mon Jun 1 01:41:04 CEST 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Sun May 31 14:45:54 2015 +0200| [074a1b37325bf6d1483fc23ebf1255e78d998339] | committer: Luca Barbato
aacpsy: Check memory allocation
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=074a1b37325bf6d1483fc23ebf1255e78d998339
---
libavcodec/aacpsy.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index ac58968..6cfe3e3 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -298,6 +298,8 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
const float num_bark = calc_bark((float)bandwidth);
ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
+ if (!ctx->model_priv_data)
+ return AVERROR(ENOMEM);
pctx = (AacPsyContext*) ctx->model_priv_data;
pctx->chan_bitrate = chan_bitrate;
@@ -349,6 +351,10 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
}
pctx->ch = av_mallocz(sizeof(AacPsyChannel) * ctx->avctx->channels);
+ if (!pctx->ch) {
+ av_freep(&pctx);
+ return AVERROR(ENOMEM);
+ }
lame_window_init(pctx, ctx->avctx);
More information about the ffmpeg-cvslog
mailing list