[libvirt] [PATCH 06/11] storage_scsi: Don't ignore the return value of VIR_STRDUP

Osier Yang jyang at redhat.com
Fri Jun 7 17:03:44 UTC 2013


---
 src/storage/storage_backend_scsi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 0a79e6c..13c498d 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -188,7 +188,12 @@ virStorageBackendSCSISerial(const char *dev)
             *nl = '\0';
     } else {
         VIR_FREE(serial);
-        ignore_value(VIR_STRDUP(serial, dev));
+        if (VIR_STRDUP(serial, dev) < 0)
+#ifdef WITH_UDEV
+            goto cleanup;
+#else
+            return NULL;
+#endif
     }
 
 #ifdef WITH_UDEV
@@ -624,7 +629,8 @@ getAdapterName(virStoragePoolSourceAdapter adapter)
     char *name = NULL;
 
     if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
-        ignore_value(VIR_STRDUP(name, adapter.data.scsi_host.name));
+        if (VIR_STRDUP(name, adapter.data.scsi_host.name) < 0)
+            return NULL;
         return name;
     }
 
-- 
1.8.1.4




More information about the libvir-list mailing list