From: Rafaël Carré Date: Wed, 26 Mar 2008 23:44:50 +0000 (+0100) Subject: Services discoveries: check memory allocation X-Git-Tag: 0.9.0-test0~1833 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d51dba48f9065eba4c167d21fe5258807e0da43f;p=vlc Services discoveries: check memory allocation --- diff --git a/modules/services_discovery/bonjour.c b/modules/services_discovery/bonjour.c index be56e325c5..482809ac5b 100644 --- a/modules/services_discovery/bonjour.c +++ b/modules/services_discovery/bonjour.c @@ -270,11 +270,9 @@ static int Open( vlc_object_t *p_this ) p_sd->p_sys = p_sys = (services_discovery_sys_t *)malloc( sizeof( services_discovery_sys_t ) ); - if( p_sd->p_sys == NULL ) - { - msg_Err( p_sd, "out of memory" ); - return VLC_EGENERIC; - } + + if( !p_sys ) + return VLC_ENOMEM; memset( p_sys, 0, sizeof(*p_sys) ); diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c index f0b33c331c..50efcc8886 100644 --- a/modules/services_discovery/podcast.c +++ b/modules/services_discovery/podcast.c @@ -106,6 +106,8 @@ static int Open( vlc_object_t *p_this ) services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_sys_t *p_sys = malloc( sizeof( services_discovery_sys_t ) ); + if( !p_sys ) + return VLC_ENOMEM; p_sys->i_urls = 0; p_sys->ppsz_urls = NULL; diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index d5912482b1..317f02afd9 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -294,6 +294,8 @@ static int Open( vlc_object_t *p_this ) services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_sys_t *p_sys = (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" );