You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
aacpsy: Check memory allocation
This commit is contained in:
committed by
Luca Barbato
parent
149fa0b7ac
commit
074a1b3732
@@ -298,6 +298,8 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
|||||||
const float num_bark = calc_bark((float)bandwidth);
|
const float num_bark = calc_bark((float)bandwidth);
|
||||||
|
|
||||||
ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
|
ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
|
||||||
|
if (!ctx->model_priv_data)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
pctx = (AacPsyContext*) ctx->model_priv_data;
|
pctx = (AacPsyContext*) ctx->model_priv_data;
|
||||||
|
|
||||||
pctx->chan_bitrate = chan_bitrate;
|
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);
|
pctx->ch = av_mallocz(sizeof(AacPsyChannel) * ctx->avctx->channels);
|
||||||
|
if (!pctx->ch) {
|
||||||
|
av_freep(&pctx);
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
lame_window_init(pctx, ctx->avctx);
|
lame_window_init(pctx, ctx->avctx);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user