Commit e7d54bc7 authored by Rémi Duraffort's avatar Rémi Duraffort

Use calloc when needed.

parent b03e7b4e
...@@ -161,10 +161,9 @@ struct decoder_synchro_t ...@@ -161,10 +161,9 @@ struct decoder_synchro_t
*****************************************************************************/ *****************************************************************************/
decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec, int i_frame_rate ) decoder_synchro_t * decoder_SynchroInit( decoder_t *p_dec, int i_frame_rate )
{ {
decoder_synchro_t * p_synchro = malloc( sizeof(*p_synchro) ); decoder_synchro_t * p_synchro = calloc( 1, sizeof(*p_synchro) );
if ( p_synchro == NULL ) if( !p_synchro )
return NULL; return NULL;
memset( p_synchro, 0, sizeof(*p_synchro) );
p_synchro->p_dec = p_dec; p_synchro->p_dec = p_dec;
p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" ); p_synchro->b_no_skip = !config_GetInt( p_dec, "skip-frames" );
......
...@@ -1213,10 +1213,9 @@ static void vlc_epg_Merge( vlc_epg_t *p_dst, const vlc_epg_t *p_src ) ...@@ -1213,10 +1213,9 @@ static void vlc_epg_Merge( vlc_epg_t *p_dst, const vlc_epg_t *p_src )
} }
if( b_add ) if( b_add )
{ {
vlc_epg_event_t *p_copy = malloc( sizeof(vlc_epg_event_t) ); vlc_epg_event_t *p_copy = calloc( 1, sizeof(vlc_epg_event_t) );
if( !p_copy ) if( !p_copy )
break; break;
memset( p_copy, 0, sizeof(vlc_epg_event_t) );
p_copy->i_start = p_evt->i_start; p_copy->i_start = p_evt->i_start;
p_copy->i_duration = p_evt->i_duration; p_copy->i_duration = p_evt->i_duration;
p_copy->psz_name = p_evt->psz_name ? strdup( p_evt->psz_name ) : NULL; p_copy->psz_name = p_evt->psz_name ? strdup( p_evt->psz_name ) : NULL;
......
...@@ -79,9 +79,10 @@ static vlc_fourcc_t Ext2Fourcc( const char * ); ...@@ -79,9 +79,10 @@ static vlc_fourcc_t Ext2Fourcc( const char * );
*/ */
image_handler_t *__image_HandlerCreate( vlc_object_t *p_this ) image_handler_t *__image_HandlerCreate( vlc_object_t *p_this )
{ {
image_handler_t *p_image = malloc( sizeof(image_handler_t) ); image_handler_t *p_image = calloc( 1, sizeof(image_handler_t) );
if( !p_image )
return NULL;
memset( p_image, 0, sizeof(image_handler_t) );
p_image->p_parent = p_this; p_image->p_parent = p_this;
p_image->pf_read = ImageRead; p_image->pf_read = ImageRead;
......
...@@ -143,12 +143,10 @@ int __stats_Get( vlc_object_t *p_this, counter_t *p_counter, vlc_value_t *val ) ...@@ -143,12 +143,10 @@ int __stats_Get( vlc_object_t *p_this, counter_t *p_counter, vlc_value_t *val )
input_stats_t *stats_NewInputStats( input_thread_t *p_input ) input_stats_t *stats_NewInputStats( input_thread_t *p_input )
{ {
(void)p_input; (void)p_input;
input_stats_t *p_stats = malloc( sizeof(input_stats_t) ); input_stats_t *p_stats = calloc( 1, sizeof(input_stats_t) );
if( !p_stats ) if( !p_stats )
return NULL; return NULL;
memset( p_stats, 0, sizeof(*p_stats) );
vlc_mutex_init( &p_stats->lock ); vlc_mutex_init( &p_stats->lock );
stats_ReinitInputStats( p_stats ); stats_ReinitInputStats( p_stats );
......
...@@ -98,11 +98,10 @@ module_t *vlc_submodule_create (module_t *module) ...@@ -98,11 +98,10 @@ module_t *vlc_submodule_create (module_t *module)
{ {
assert (module != NULL); assert (module != NULL);
module_t *submodule = malloc (sizeof (*submodule)); module_t *submodule = calloc( 1, sizeof(*submodule) );
if (submodule == NULL) if( !submodule )
return NULL; return NULL;
memset (submodule, 0, sizeof (*submodule));
vlc_gc_init (submodule, vlc_submodule_destruct); vlc_gc_init (submodule, vlc_submodule_destruct);
submodule->next = module->submodule; submodule->next = module->submodule;
......
...@@ -700,7 +700,7 @@ static int TreeMove( playlist_t *p_playlist, playlist_item_t *p_item, ...@@ -700,7 +700,7 @@ static int TreeMove( playlist_t *p_playlist, playlist_item_t *p_item,
REMOVE_ELEM( p_detach->pp_children, p_detach->i_children, j ); REMOVE_ELEM( p_detach->pp_children, p_detach->i_children, j );
/* If j < i_newpos, we are moving the element from the top to the /* If j < i_newpos, we are moving the element from the top to the
* down of the playlist. So when removing the element we change have * down of the playlist. So when removing the element we have
* to change the position as we loose one element * to change the position as we loose one element
*/ */
if( j < i_newpos ) if( j < i_newpos )
......
...@@ -65,12 +65,10 @@ sout_AnnounceRegisterSDP( vlc_object_t *obj, const char *psz_sdp, ...@@ -65,12 +65,10 @@ sout_AnnounceRegisterSDP( vlc_object_t *obj, const char *psz_sdp,
assert (p_method == &sap_method); assert (p_method == &sap_method);
(void) p_method; (void) p_method;
session_descriptor_t *p_session = malloc (sizeof (*p_session)); session_descriptor_t *p_session = calloc( 1, sizeof (*p_session) );
if( !p_session )
if (!p_session)
return NULL; return NULL;
memset( p_session, 0, sizeof( *p_session ) );
p_session->psz_sdp = strdup( psz_sdp ); p_session->psz_sdp = strdup( psz_sdp );
/* GRUIK. We should not convert back-and-forth from string to numbers */ /* GRUIK. We should not convert back-and-forth from string to numbers */
......
...@@ -1006,12 +1006,10 @@ static void PictureReleaseCallback( picture_t *p_picture ) ...@@ -1006,12 +1006,10 @@ static void PictureReleaseCallback( picture_t *p_picture )
*****************************************************************************/ *****************************************************************************/
picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect )
{ {
picture_t *p_picture = malloc( sizeof(*p_picture) ); picture_t *p_picture = calloc( 1, sizeof(*p_picture) );
if( !p_picture ) if( !p_picture )
return NULL; return NULL;
memset( p_picture, 0, sizeof(*p_picture) );
if( __vout_AllocatePicture( NULL, p_picture, if( __vout_AllocatePicture( NULL, p_picture,
i_chroma, i_width, i_height, i_aspect ) ) i_chroma, i_width, i_height, i_aspect ) )
{ {
......
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