[vlc-commits] g711: use vlc_obj_malloc() and simplify

Rémi Denis-Courmont git at videolan.org
Fri Sep 25 15:53:49 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 16:29:53 2020 +0300| [42e093a4f9e6366d10bd1cd6723458ef258b81cb] | committer: Rémi Denis-Courmont

g711: use vlc_obj_malloc() and simplify

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

 modules/codec/g711.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index 789f6feaa5..1e55b1d54a 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -32,7 +32,6 @@
 #include <vlc_aout.h>
 
 static int  DecoderOpen ( vlc_object_t * );
-static void DecoderClose( vlc_object_t * );
 static int DecodeBlock( decoder_t *, block_t * );
 static void Flush( decoder_t * );
 
@@ -46,7 +45,7 @@ vlc_module_begin ()
     set_capability( "audio decoder", 100 )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACODEC )
-    set_callbacks( DecoderOpen, DecoderClose )
+    set_callback( DecoderOpen )
 
 #ifdef ENABLE_SOUT
     add_submodule ()
@@ -178,7 +177,7 @@ static int DecoderOpen( vlc_object_t *p_this )
 
 
     /* Allocate the memory needed to store the decoder's structure */
-    decoder_sys_t *p_sys = malloc(sizeof(*p_sys));
+    decoder_sys_t *p_sys = vlc_obj_malloc(p_this, sizeof(*p_sys));
     if( unlikely(p_sys == NULL) )
         return VLC_ENOMEM;
 
@@ -283,13 +282,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
     return VLCDEC_SUCCESS;
 }
 
-static void DecoderClose( vlc_object_t *p_this )
-{
-    decoder_t *p_dec = (decoder_t *)p_this;
-
-    free( p_dec->p_sys );
-}
-
 #ifdef ENABLE_SOUT
 static const int8_t alaw_encode[2049] =
 {



More information about the vlc-commits mailing list