summaryrefslogtreecommitdiffstats
path: root/libavcodec/aacpsy.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 14:45:54 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 15:03:30 +0200
commit074a1b37325bf6d1483fc23ebf1255e78d998339 (patch)
tree0df94b0c96da40275c54ab71b9d396f3d1422ae2 /libavcodec/aacpsy.c
parent149fa0b7ac180fe1df48a2e379c560813555bf57 (diff)
downloadffmpeg-streaming-074a1b37325bf6d1483fc23ebf1255e78d998339.zip
ffmpeg-streaming-074a1b37325bf6d1483fc23ebf1255e78d998339.tar.gz
aacpsy: Check memory allocation
Diffstat (limited to 'libavcodec/aacpsy.c')
-rw-r--r--libavcodec/aacpsy.c6
1 files changed, 6 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud