From d51dba48f9065eba4c167d21fe5258807e0da43f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Thu, 27 Mar 2008 00:44:50 +0100 Subject: [PATCH] Services discoveries: check memory allocation --- modules/services_discovery/bonjour.c | 8 +++----- modules/services_discovery/podcast.c | 2 ++ modules/services_discovery/sap.c | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) 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" ); -- 2.39.2