diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-02-28 09:56:15 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-02-28 09:56:15 +0000 |
commit | 4c02e46daf43c133cf3cafe7daa8d3decaeb05d1 (patch) | |
tree | e80a8d12ca1b382946908916ad4be4ca721e93fa /libavcodec/faac.c | |
parent | c52ff68852ce65cd26eb03074904f39a01519ef1 (diff) | |
download | ffmpeg-4c02e46daf43c133cf3cafe7daa8d3decaeb05d1.tar.gz |
free faac extradata
Originally committed as revision 8161 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/faac.c')
-rw-r--r-- | libavcodec/faac.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/faac.c b/libavcodec/faac.c index 06e0b49207..9ff9f5ed0a 100644 --- a/libavcodec/faac.c +++ b/libavcodec/faac.c @@ -76,15 +76,19 @@ static int Faac_encode_init(AVCodecContext *avctx) 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 @@ static int Faac_encode_close(AVCodecContext *avctx) 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; |