Commit 1acfbd82 authored by Jean-Paul Saman's avatar Jean-Paul Saman

modules/demux/ts.c: replace malloc+memset with calloc

Replace the combination of malloc() and memset() on the same pointer by
one instance of calloc(), which does both.
parent ac4b9763
......@@ -560,10 +560,10 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->i_packet_size = i_packet_size;
vlc_mutex_init( &p_sys->csa_lock );
......@@ -1405,11 +1405,10 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt )
PIDInit( pmt, true, NULL );
/* Dummy PMT */
prg = malloc( sizeof( ts_prg_psi_t ) );
prg = calloc( 1, sizeof( ts_prg_psi_t ) );
if( !prg )
goto error;
memset( prg, 0, sizeof( ts_prg_psi_t ) );
prg->i_pid_pcr = -1;
prg->i_pid_pmt = -1;
prg->i_version = -1;
......@@ -2191,9 +2190,8 @@ static iod_descriptor_t *IODNew( int i_data, uint8_t *p_data )
bool b_url;
int i_iod_length;
p_iod = malloc( sizeof( iod_descriptor_t ) );
p_iod = calloc( 1, sizeof( iod_descriptor_t ) );
if( !p_iod ) return NULL;
memset( p_iod, 0, sizeof( iod_descriptor_t ) );
#ifdef TS_DEBUG
fprintf( stderr, "\n************ IOD ************" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment