avcodec/libaacplus: Check for av_malloc() failure

Fixes CID1271046

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-22 14:00:53 +01:00
parent 48214956b2
commit 642c49c983
1 changed files with 4 additions and 0 deletions

View File

@ -82,6 +82,10 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer,
&decoder_specific_info_size) == 1) {
avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata) {
free(buffer);
return AVERROR(ENOMEM);
}
avctx->extradata_size = decoder_specific_info_size;
memcpy(avctx->extradata, buffer, avctx->extradata_size);
}