[vlc-commits] cdg: use vlc_obj_malloc()

Rémi Denis-Courmont git at videolan.org
Thu May 3 18:46:18 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May  3 19:42:05 2018 +0300| [3037f5964b43ee60e6552a2c5c9e0d3412da5389] | committer: Rémi Denis-Courmont

cdg: use vlc_obj_malloc()

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

 modules/demux/cdg.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index 5e627bb48d..2832be116c 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -37,14 +37,13 @@
  * Module descriptor
  *****************************************************************************/
 static int  Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
 
 vlc_module_begin ()
     set_description( N_("CDG demuxer") )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_capability( "demux", 3 )
-    set_callbacks( Open, Close )
+    set_callbacks( Open, NULL )
     add_shortcut( "cdg", "subtitle" )
 vlc_module_end ()
 
@@ -71,7 +70,6 @@ typedef struct
 static int Open( vlc_object_t * p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
-    demux_sys_t *p_sys;
 
     /* Identify cdg file by extension, as there is no simple way to
      * detect it */
@@ -86,7 +84,7 @@ static int Open( vlc_object_t * p_this )
 //        return VLC_EGENERIC;
 //    }
 
-    p_sys = malloc( sizeof( demux_sys_t ) );
+    demux_sys_t *p_sys = vlc_obj_malloc( p_this, sizeof (*p_sys) );
     if( unlikely(p_sys == NULL) )
         return VLC_ENOMEM;
 
@@ -154,17 +152,6 @@ static int Demux( demux_t *p_demux )
 }
 
 /*****************************************************************************
- * Close: frees unused data
- *****************************************************************************/
-static void Close ( vlc_object_t * p_this )
-{
-    demux_t *p_demux = (demux_t *)p_this;
-    demux_sys_t *p_sys = p_demux->p_sys;
-
-    free( p_sys );
-}
-
-/*****************************************************************************
  * Control:
  *****************************************************************************/
 static int Control( demux_t *p_demux, int i_query, va_list args )



More information about the vlc-commits mailing list