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

Use calloc instead of malloc+memset.

parent f2014437
...@@ -622,10 +622,9 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id ...@@ -622,10 +622,9 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
p_vlm->p_vod->pf_media_control = vlm_MediaVodControl; p_vlm->p_vod->pf_media_control = vlm_MediaVodControl;
} }
p_media = malloc( sizeof( vlm_media_sys_t ) ); p_media = calloc( 1, sizeof( vlm_media_sys_t ) );
if( !p_media ) if( !p_media )
return VLC_ENOMEM; return VLC_ENOMEM;
memset( p_media, 0, sizeof(vlm_media_sys_t) );
if( p_cfg->b_vod ) if( p_cfg->b_vod )
p_vlm->i_vod++; p_vlm->i_vod++;
...@@ -743,12 +742,10 @@ static vlm_media_instance_sys_t *vlm_ControlMediaInstanceGetByName( vlm_media_sy ...@@ -743,12 +742,10 @@ static vlm_media_instance_sys_t *vlm_ControlMediaInstanceGetByName( vlm_media_sy
} }
static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char *psz_name ) static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char *psz_name )
{ {
vlm_media_instance_sys_t *p_instance = malloc( sizeof(vlm_media_instance_sys_t) ); vlm_media_instance_sys_t *p_instance = calloc( 1, sizeof(vlm_media_instance_sys_t) );
if( !p_instance ) if( !p_instance )
return NULL; return NULL;
memset( p_instance, 0, sizeof(vlm_media_instance_sys_t) );
p_instance->psz_name = NULL; p_instance->psz_name = NULL;
if( psz_name ) if( psz_name )
p_instance->psz_name = strdup( psz_name ); p_instance->psz_name = strdup( psz_name );
...@@ -1154,3 +1151,4 @@ int vlm_Control( vlm_t *p_vlm, int i_query, ... ) ...@@ -1154,3 +1151,4 @@ int vlm_Control( vlm_t *p_vlm, int i_query, ... )
return i_result; return i_result;
} }
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