[libvirt] [PATCH libvirt-snmp 2/3] eliminate bogus check for "NULL" array

Laine Stump laine at laine.org
Tue Oct 18 17:13:14 UTC 2011


This is another bug found by coverity in:

   https://bugzilla.redhat.com/show_bug.cgi?id=732015

Apparently libvirtGuestUUID was originally a pointer, and the code was
making sure that it had memory allocated, but now it is an array that
is contained in the structure, so checking for NULL makes no sense.
---
 src/libvirtGuestTable_data_get.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/libvirtGuestTable_data_get.c b/src/libvirtGuestTable_data_get.c
index cc31e9e..497b3f8 100644
--- a/src/libvirtGuestTable_data_get.c
+++ b/src/libvirtGuestTable_data_get.c
@@ -83,9 +83,7 @@ libvirtGuestTable_indexes_set_tbl_idx(libvirtGuestTable_mib_index *tbl_idx, char
     /*
      * make sure there is enough space for libvirtGuestUUID data
      */
-    if ((NULL == tbl_idx->libvirtGuestUUID) ||
-        (tbl_idx->libvirtGuestUUID_len <
-         (libvirtGuestUUID_val_ptr_len))) {
+    if (tbl_idx->libvirtGuestUUID_len < (libvirtGuestUUID_val_ptr_len)) {
         snmp_log(LOG_ERR,"not enough space for value\n");
         return MFD_ERROR;
     }
-- 
1.7.6.4




More information about the libvir-list mailing list