[vlc-commits] Avcodec: use av_malloc/av_free for buffers

Jean-Baptiste Kempf git at videolan.org
Mon Jun 9 12:16:16 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jun  9 12:06:47 2014 +0200| [195365fa2ee79e514ff81eef55b3a288a26b4267] | committer: Jean-Baptiste Kempf

Avcodec: use av_malloc/av_free for buffers

Ref #11490

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

 modules/codec/avcodec/encoder.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 3062850..f1eb4cb 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -970,7 +970,7 @@ errmsg:
         p_sys->i_buffer_out = av_samples_get_buffer_size(NULL,
                 p_sys->p_context->channels, p_sys->i_frame_size,
                 p_sys->p_context->sample_fmt, DEFAULT_ALIGN);
-        p_sys->p_buffer = malloc( p_sys->i_buffer_out );
+        p_sys->p_buffer = av_malloc( p_sys->i_buffer_out );
         if ( unlikely( p_sys->p_buffer == NULL ) )
         {
             goto error;
@@ -984,7 +984,7 @@ errmsg:
 
         if( p_sys->b_planar )
         {
-            p_sys->p_interleave_buf = malloc( p_sys->i_buffer_out );
+            p_sys->p_interleave_buf = av_malloc( p_sys->i_buffer_out );
             if( unlikely( p_sys->p_interleave_buf == NULL ) )
                 goto error;
         }
@@ -1004,8 +1004,8 @@ errmsg:
     return VLC_SUCCESS;
 error:
     free( p_enc->fmt_out.p_extra );
-    free( p_sys->p_buffer );
-    free( p_sys->p_interleave_buf );
+    av_free( p_sys->p_buffer );
+    av_free( p_sys->p_interleave_buf );
     free( p_sys );
     return VLC_ENOMEM;
 }
@@ -1447,8 +1447,8 @@ void CloseEncoder( vlc_object_t *p_this )
     av_free( p_sys->p_context );
 
 
-    free( p_sys->p_interleave_buf );
-    free( p_sys->p_buffer );
+    av_free( p_sys->p_interleave_buf );
+    av_free( p_sys->p_buffer );
 
     free( p_sys );
 }



More information about the vlc-commits mailing list