[libvirt] [PATCH 3/3] storage: No need to check ret after VIR_APPEND_ELEMENT

John Ferlan jferlan at redhat.com
Thu Feb 25 14:21:35 UTC 2016


Generates a false positive for Coverity, but it turns out there's no need
to check ret == -1 since if VIR_APPEND_ELEMENT is successful, the local
vol pointer is cleared anyway.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_backend_logical.c | 2 +-
 src/storage/storage_backend_zfs.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index f0d6f80..167fe58 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -307,7 +307,7 @@ virStorageBackendLogicalMakeVol(char **const groups,
     ret = 0;
 
  cleanup:
-    if (is_new_vol && (ret == -1))
+    if (is_new_vol)
         virStorageVolDefFree(vol);
     return ret;
 }
diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index 4d04c70..2e6e407 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -161,7 +161,7 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
  cleanup:
     virStringFreeList(tokens);
     virStringFreeList(name_tokens);
-    if (is_new_vol && (ret == -1))
+    if (is_new_vol)
         virStorageVolDefFree(volume);
     return ret;
 }
-- 
2.5.0




More information about the libvir-list mailing list