Mercurial > libavcodec.hg
changeset 4606:d77c5a6824e4 libavcodec
free faac extradata
author | bcoudurier |
---|---|
date | Wed, 28 Feb 2007 09:56:15 +0000 |
parents | d4feec96fd64 |
children | d15120610df2 |
files | faac.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/faac.c Wed Feb 28 06:59:39 2007 +0000 +++ b/faac.c Wed Feb 28 09:56:15 2007 +0000 @@ -76,15 +76,19 @@ avctx->extradata_size = 0; if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { - unsigned char *buffer; + unsigned char *buffer = NULL; unsigned long decoder_specific_info_size; if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer, &decoder_specific_info_size)) { - avctx->extradata = buffer; + avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = decoder_specific_info_size; + memcpy(avctx->extradata, buffer, avctx->extradata_size); faac_cfg->outputFormat = 0; } +#undef free + free(buffer); +#define free please_use_av_free } if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) { @@ -115,8 +119,7 @@ FaacAudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); - - //if (avctx->extradata_size) free(avctx->extradata); + av_freep(&avctx->extradata); faacEncClose(s->faac_handle); return 0;