]> git.sesse.net Git - vlc/commitdiff
Services discoveries: check memory allocation
authorRafaël Carré <funman@videolan.org>
Wed, 26 Mar 2008 23:44:50 +0000 (00:44 +0100)
committerRafaël Carré <funman@videolan.org>
Wed, 26 Mar 2008 23:46:21 +0000 (00:46 +0100)
modules/services_discovery/bonjour.c
modules/services_discovery/podcast.c
modules/services_discovery/sap.c

index be56e325c5118f165aa5f5d29a5887913f7fcccb..482809ac5b8ed4409ea4bf5ca3e81baafb3c9d02 100644 (file)
@@ -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) );
 
index f0b33c331ca6cf064f57d15ce24db0402c40723e..50efcc888610025a56214e18174049b802e5e143 100644 (file)
@@ -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;
index d5912482b1798b23ce756f65f1ff2b376205bdce..317f02afd9d3e6b84ec27db0bfa19d88ed843685 100644 (file)
@@ -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" );