[vlc-commits] xa: use vlc_obj_malloc()
Rémi Denis-Courmont
git at videolan.org
Thu May 3 10:59:41 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 3 11:58:16 2018 +0300| [322c06644e306a5f5c79ac5a5830a09ea94e873c] | committer: Rémi Denis-Courmont
xa: use vlc_obj_malloc()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=322c06644e306a5f5c79ac5a5830a09ea94e873c
---
modules/demux/xa.c | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/modules/demux/xa.c b/modules/demux/xa.c
index 6d1f86f376..655cb9512a 100644
--- a/modules/demux/xa.c
+++ b/modules/demux/xa.c
@@ -38,14 +38,13 @@
* Module descriptor
*****************************************************************************/
static int Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
vlc_module_begin ()
set_description( N_("XA demuxer") )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
set_capability( "demux", 10 )
- set_callbacks( Open, Close )
+ set_callbacks( Open, NULL )
vlc_module_end ()
/*****************************************************************************
@@ -102,7 +101,7 @@ static int Open( vlc_object_t * p_this )
if( GetWLE( peek + 8 ) != 1 ) /* format tag */
return VLC_EGENERIC;
- demux_sys_t *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;
@@ -110,10 +109,7 @@ static int Open( vlc_object_t * p_this )
xa_header_t xa;
if( vlc_stream_Read( p_demux->s, &xa, HEADER_LENGTH ) < HEADER_LENGTH )
- {
- free( p_sys );
return VLC_EGENERIC;
- }
es_format_t fmt;
es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_ADPCM_XA_EA );
@@ -143,10 +139,7 @@ static int Open( vlc_object_t * p_this )
if( fmt.audio.i_rate == 0 || fmt.audio.i_channels == 0
|| fmt.audio.i_bitspersample != 16 )
- {
- free( p_sys );
return VLC_EGENERIC;
- }
p_sys->p_es = es_out_Add( p_demux->out, &fmt );
@@ -196,16 +189,6 @@ static int Demux( demux_t *p_demux )
}
/*****************************************************************************
- * Close: frees unused data
- *****************************************************************************/
-static void Close ( vlc_object_t * p_this )
-{
- demux_sys_t *p_sys = ((demux_t *)p_this)->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