[Libvirt-cim] [PATCH 1 of 2] SDC: harden free_rasd_prop_list to handle NULL pointer

Heidi Eckhart heidieck at linux.vnet.ibm.com
Mon Dec 17 07:49:53 UTC 2007


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1197881324 -3600
# Node ID 109fd77699732a1bc2969b93d9a799c446b3f4c0
# Parent  72b93a4339e1c13080d6a6d80a580a7742c0b851
SDC: harden free_rasd_prop_list to handle NULL pointer
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 72b93a4339e1 -r 109fd7769973 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Fri Dec 14 10:37:01 2007 +0100
+++ b/src/Virt_SettingsDefineCapabilities.c	Mon Dec 17 09:48:44 2007 +0100
@@ -89,17 +89,19 @@ static bool dup_rasd_prop_list(struct sd
         return true;
 }
 
-static bool free_rasd_prop_list(struct sdc_rasd_prop *prop_list)
+static void free_rasd_prop_list(struct sdc_rasd_prop *prop_list)
 {
         int i;
+        
+        if (!prop_list)
+                return;
 
         for (i = 0; prop_list[i].field != NULL; i++) {
                 free(prop_list[i].field);
                 free(prop_list[i].value);
         }
-
+        
         free (prop_list);
-        return true;
 }
 
 static struct sdc_rasd_prop *mem_max(const CMPIObjectPath *ref,




More information about the Libvirt-cim mailing list