[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] PATCH: Fix free of uninitialized data on PCI device failure



The pci.c file was freeing a variable that was not initialized in its
failure path. This causes a crash if the user specifies a PCI device
for a guest which does not exist

commit 87f584fdd688865b4ea7f54d1b631f546535d8c2
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Jul 16 13:23:32 2009 +0100

    Fix free of unitialized data upon PCI open fail

diff --git a/src/pci.c b/src/pci.c
index 3ffa0aa..4030a14 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -834,10 +834,8 @@ pciReadDeviceID(pciDevice *dev, const char *id_name)
              dev->name, id_name);
 
     /* ID string is '0xNNNN\n' ... i.e. 7 bytes */
-    if (virFileReadAll(path, 7, &id_str) < 7) {
-        VIR_FREE(id_str);
+    if (virFileReadAll(path, 7, &id_str) < 0)
         return NULL;
-    }
 
     /* Check for 0x suffix */
     if (id_str[0] != '0' || id_str[1] != 'x') {


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]