Commit 9ee5f674 authored by Rémi Duraffort's avatar Rémi Duraffort

Use calloc.

parent 347bfe4d
......@@ -206,10 +206,9 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
p_dec->pf_decode_sub = Decode;
p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
p_sys = p_dec->p_sys = calloc( 1, sizeof(decoder_sys_t) );
if( p_sys == NULL )
return VLC_ENOMEM;
memset( p_sys, 0, sizeof(decoder_sys_t) );
p_sys->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0';
p_sys->b_update = false;
......@@ -246,8 +245,7 @@ static int Open( vlc_object_t *p_this )
/* Create the var on vlc_global. */
p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
var_AddCallback( p_dec, "vbi-page",
RequestPage, p_sys );
var_AddCallback( p_dec, "vbi-page", RequestPage, p_sys );
/* Check if the Teletext track has a known "initial page". */
if( p_sys->i_wanted_page == 100 && p_dec->fmt_in.subs.teletext.i_magazine != -1 )
......
......@@ -313,8 +313,7 @@ static int Open( vlc_object_t * p_this )
p_demux->pf_control = Control;
/* create our structure that will contains all data */
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
/* Now load all boxes ( except raw data ) */
if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
......
......@@ -195,14 +195,13 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
msg_Dbg( p_this, "reading %ld bytes from template %s",
(unsigned long)s.st_size, psz_filename );
psz_template = malloc( s.st_size + 42 );
psz_template = calloc( 1, s.st_size + 42 );
if( !psz_template )
{
fclose( file );
free( psz_filename );
return NULL;
}
memset( psz_template, 0, s.st_size + 1 );
if(! fread( psz_template, s.st_size, 1, file ) )
{
msg_Dbg( p_this, "No data read from template." );
......@@ -469,13 +468,12 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
int length;
char* psz_template = p_sys->psz_template;
length = strlen( psz_string ) + strlen( psz_template ) + 42;
p_svg->psz_text = malloc( length + 1 );
p_svg->psz_text = calloc( 1, length + 1 );
if( !p_svg->psz_text )
{
free( p_svg );
return VLC_ENOMEM;
}
memset( p_svg->psz_text, 0, length + 1 );
snprintf( p_svg->psz_text, length, psz_template, psz_string );
}
p_svg->i_width = p_sys->i_width;
......
......@@ -91,12 +91,10 @@ static int Activate( vlc_object_t *p_this )
if( !b_chroma && !b_resize )
return VLC_EGENERIC;
p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
p_sys = p_filter->p_sys = calloc( 1, sizeof( *p_sys ) );
if( !p_sys )
return VLC_ENOMEM;
memset( p_sys, 0, sizeof( *p_sys ) );
p_sys->p_chain = filter_chain_New( p_filter, "video filter2", false, BufferAllocationInit, NULL, p_filter );
if( !p_sys->p_chain )
{
......
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