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

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


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

araw: use vlc_obj_malloc() and simplify

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

 modules/codec/araw.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 2f819c1270..c8c921414e 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -39,7 +39,6 @@
  * Module descriptor
  *****************************************************************************/
 static int  DecoderOpen ( vlc_object_t * );
-static void DecoderClose( vlc_object_t * );
 
 #ifdef ENABLE_SOUT
 static int  EncoderOpen ( vlc_object_t * );
@@ -51,7 +50,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
     /* audio encoder submodule */
@@ -257,7 +256,7 @@ static int DecoderOpen( vlc_object_t *p_this )
              p_dec->fmt_in.audio.i_bitspersample );
 
     /* 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;
 
@@ -629,16 +628,6 @@ static void DAT12Decode( void *outp, const uint8_t *in, unsigned samples )
         *(out++) = dat12tos16(U16_AT(in) >> 4);
 }
 
-/*****************************************************************************
- * DecoderClose: decoder destruction
- *****************************************************************************/
-static void DecoderClose( vlc_object_t *p_this )
-{
-    decoder_t *p_dec = (decoder_t *)p_this;
-
-    free( p_dec->p_sys );
-}
-
 #ifdef ENABLE_SOUT
 /* NOTE: Output buffers are always aligned since they are allocated by the araw plugin.
  * Contrary to the decoder, the encoder can also assume that input buffers are aligned,



More information about the vlc-commits mailing list