mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-16 16:02:54 +02:00
Use calloc.
This commit is contained in:
parent
347bfe4d12
commit
9ee5f674f8
@ -206,10 +206,9 @@ static int Open( vlc_object_t *p_this )
|
|||||||
return VLC_EGENERIC;
|
return VLC_EGENERIC;
|
||||||
|
|
||||||
p_dec->pf_decode_sub = Decode;
|
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 )
|
if( p_sys == NULL )
|
||||||
return VLC_ENOMEM;
|
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->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0';
|
||||||
p_sys->b_update = false;
|
p_sys->b_update = false;
|
||||||
@ -246,8 +245,7 @@ static int Open( vlc_object_t *p_this )
|
|||||||
|
|
||||||
/* Create the var on vlc_global. */
|
/* Create the var on vlc_global. */
|
||||||
p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
|
p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
|
||||||
var_AddCallback( p_dec, "vbi-page",
|
var_AddCallback( p_dec, "vbi-page", RequestPage, p_sys );
|
||||||
RequestPage, p_sys );
|
|
||||||
|
|
||||||
/* Check if the Teletext track has a known "initial page". */
|
/* 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 )
|
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;
|
p_demux->pf_control = Control;
|
||||||
|
|
||||||
/* create our structure that will contains all data */
|
/* create our structure that will contains all data */
|
||||||
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
|
p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
|
||||||
memset( p_sys, 0, sizeof( demux_sys_t ) );
|
|
||||||
|
|
||||||
/* Now load all boxes ( except raw data ) */
|
/* Now load all boxes ( except raw data ) */
|
||||||
if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
|
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",
|
msg_Dbg( p_this, "reading %ld bytes from template %s",
|
||||||
(unsigned long)s.st_size, psz_filename );
|
(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 )
|
if( !psz_template )
|
||||||
{
|
{
|
||||||
fclose( file );
|
fclose( file );
|
||||||
free( psz_filename );
|
free( psz_filename );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset( psz_template, 0, s.st_size + 1 );
|
|
||||||
if(! fread( psz_template, s.st_size, 1, file ) )
|
if(! fread( psz_template, s.st_size, 1, file ) )
|
||||||
{
|
{
|
||||||
msg_Dbg( p_this, "No data read from template." );
|
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;
|
int length;
|
||||||
char* psz_template = p_sys->psz_template;
|
char* psz_template = p_sys->psz_template;
|
||||||
length = strlen( psz_string ) + strlen( psz_template ) + 42;
|
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 )
|
if( !p_svg->psz_text )
|
||||||
{
|
{
|
||||||
free( p_svg );
|
free( p_svg );
|
||||||
return VLC_ENOMEM;
|
return VLC_ENOMEM;
|
||||||
}
|
}
|
||||||
memset( p_svg->psz_text, 0, length + 1 );
|
|
||||||
snprintf( p_svg->psz_text, length, psz_template, psz_string );
|
snprintf( p_svg->psz_text, length, psz_template, psz_string );
|
||||||
}
|
}
|
||||||
p_svg->i_width = p_sys->i_width;
|
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 )
|
if( !b_chroma && !b_resize )
|
||||||
return VLC_EGENERIC;
|
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 )
|
if( !p_sys )
|
||||||
return VLC_ENOMEM;
|
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 );
|
p_sys->p_chain = filter_chain_New( p_filter, "video filter2", false, BufferAllocationInit, NULL, p_filter );
|
||||||
if( !p_sys->p_chain )
|
if( !p_sys->p_chain )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user