]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't free an uninitalized pointer in update_driver_name()
authorMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 23 Dec 2009 21:18:04 +0000 (22:18 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 7 Jan 2010 00:38:19 +0000 (01:38 +0100)
This invalid free results in heap corruption. Some symptoms I saw
because of this were libvirtd crashing and virt-manager hanging
while trying to enumerate devices.

src/node_device/node_device_driver.c

index ecbac0f625565587fe4ad716357d31e788ca667c..fbadfcab26ced5a24ec612d5d2e63adf954357fc 100644 (file)
@@ -78,7 +78,7 @@ static int update_driver_name(virConnectPtr conn,
                               virNodeDeviceObjPtr dev)
 {
     char *driver_link = NULL;
-    char *devpath;
+    char *devpath = NULL;
     char *p;
     int ret = -1;
 
@@ -114,7 +114,7 @@ static int update_driver_name(virConnectPtr conn,
 
 cleanup:
     VIR_FREE(driver_link);
-    free(devpath);
+    VIR_FREE(devpath);
     return ret;
 }
 #else