[PATCH] qemu: Avoid NULL dereference in qemuSharedDiskEntryFree

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

 



At least one caller may call qemuSharedDiskEntryFree with NULL as the
first argument. Let's make the function similar to other *Free functions
and do nothing in such case.
---
 src/qemu/qemu_conf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 3ef3499..2408610 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1045,6 +1045,9 @@ qemuSharedDiskEntryFree(void *payload, const void *name ATTRIBUTE_UNUSED)
     qemuSharedDiskEntryPtr entry = payload;
     size_t i;
 
+    if (!entry)
+        return;
+
     for (i = 0; i < entry->ref; i++) {
         VIR_FREE(entry->domains[i]);
     }
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]