[Libvirt-cim] [PATCH 2 of 2] Fix seg fault in Virt_DevicePool - verify to be sure list is not NULL

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Oct 28 20:01:46 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1256771106 25200
# Node ID 68c625f1d36545bc3de39ae0c1402914d8dc2b58
# Parent  4eed878f31e95806a9cd345f656b7382945b8985
Fix seg fault in Virt_DevicePool - verify to be sure list is not NULL

This can happen if _get_pools() is unable to connect to libvirt.

diff -r 4eed878f31e9 -r 68c625f1d365 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Mon Oct 26 07:47:48 2009 -0700
+++ b/src/Virt_DevicePool.c	Wed Oct 28 16:05:06 2009 -0700
@@ -1210,6 +1210,14 @@
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
+        if (list.cur <= 0) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such instance (%s)",
+                           id);
+                goto out;
+        }
+
         *_inst = list.list[0];
 
  out:




More information about the Libvirt-cim mailing list