Commit d51dba48 authored by Rafaël Carré's avatar Rafaël Carré

Services discoveries: check memory allocation

parent 8ca4ff01
...@@ -270,11 +270,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -270,11 +270,9 @@ static int Open( vlc_object_t *p_this )
p_sd->p_sys = p_sys = (services_discovery_sys_t *)malloc( p_sd->p_sys = p_sys = (services_discovery_sys_t *)malloc(
sizeof( services_discovery_sys_t ) ); sizeof( services_discovery_sys_t ) );
if( p_sd->p_sys == NULL )
{ if( !p_sys )
msg_Err( p_sd, "out of memory" ); return VLC_ENOMEM;
return VLC_EGENERIC;
}
memset( p_sys, 0, sizeof(*p_sys) ); memset( p_sys, 0, sizeof(*p_sys) );
......
...@@ -106,6 +106,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -106,6 +106,8 @@ static int Open( vlc_object_t *p_this )
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = malloc( services_discovery_sys_t *p_sys = malloc(
sizeof( services_discovery_sys_t ) ); sizeof( services_discovery_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
p_sys->i_urls = 0; p_sys->i_urls = 0;
p_sys->ppsz_urls = NULL; p_sys->ppsz_urls = NULL;
......
...@@ -294,6 +294,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -294,6 +294,8 @@ static int Open( vlc_object_t *p_this )
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = (services_discovery_sys_t *) services_discovery_sys_t *p_sys = (services_discovery_sys_t *)
malloc( sizeof( services_discovery_sys_t ) ); malloc( sizeof( services_discovery_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
p_sys->i_timeout = var_CreateGetInteger( p_sd, "sap-timeout" ); p_sys->i_timeout = var_CreateGetInteger( p_sd, "sap-timeout" );
......
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