[vlc-devel] commit: Used av_malloc/free for avcodec_decode_audio2 output buffer. ( Laurent Aimar )

git version control git at videolan.org
Fri Jun 19 00:13:06 CEST 2009


vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Thu Jun 18 23:38:05 2009 +0200| [8564398fe65712816f1f4b5019c5be4dafc586ba] | committer: Derk-Jan Hartman 

Used av_malloc/free for avcodec_decode_audio2 output buffer.

It is needed to ensure valid buffer alignment.
(cherry picked from commit ae6189240799ea4f5e9f300b0ae24813dbfd4295)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8564398fe65712816f1f4b5019c5be4dafc586ba
---

 modules/codec/avcodec/audio.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index baa70a1..36a1b8c 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -197,7 +197,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( p_sys->i_output_max < AVCODEC_MAX_AUDIO_FRAME_SIZE )
         p_sys->i_output_max = AVCODEC_MAX_AUDIO_FRAME_SIZE;
     msg_Dbg( p_dec, "Using %d bytes output buffer", p_sys->i_output_max );
-    p_sys->p_output = malloc( p_sys->i_output_max );
+    p_sys->p_output = av_malloc( p_sys->i_output_max );
 
     p_sys->p_samples = NULL;
     p_sys->i_samples = 0;
@@ -300,7 +300,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
     if( i_output > p_sys->i_output_max )
     {
         /* Grow output buffer if necessary (eg. for PCM data) */
-        p_sys->p_output = realloc( p_sys->p_output, i_output );
+        p_sys->p_output = av_realloc( p_sys->p_output, i_output );
     }
 
     *pp_block = p_block = block_Realloc( p_block, 0, p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
@@ -384,7 +384,7 @@ void EndAudioDec( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    free( p_sys->p_output );
+    av_free( p_sys->p_output );
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list