[PATCH v2] test: Fix coverity warnings

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

 



---
v2:
    Address Eric's suggestion
    Address additional coverity warnings pointed out by John

 src/test/test_driver.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 255cc2b..c2e530e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6547,16 +6547,12 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
 {
     virDomainObjPtr vm = NULL;
     int ret = -1;
-    virDomainSnapshotObjPtr snap = NULL;
 
     virCheckFlags(0, -1);
 
     if (!(vm = testDomObjFromSnapshot(snapshot)))
         goto cleanup;
 
-    if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
-        goto cleanup;
-
     ret = (vm->current_snapshot &&
            STREQ(snapshot->name, vm->current_snapshot->def->name));
 
@@ -6573,14 +6569,13 @@ testDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
 {
     virDomainObjPtr vm = NULL;
     int ret = -1;
-    virDomainSnapshotObjPtr snap = NULL;
 
     virCheckFlags(0, -1);
 
     if (!(vm = testDomObjFromSnapshot(snapshot)))
         goto cleanup;
 
-    if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
+    if (!testSnapObjFromSnapshot(vm, snapshot))
         goto cleanup;
 
     ret = 1;
@@ -6679,8 +6674,8 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
         goto cleanup;
 
     if (redefine) {
-        if (!virDomainSnapshotRedefinePrep(domain, vm, &def, &snap,
-                                           &update_current, flags) < 0)
+        if (virDomainSnapshotRedefinePrep(domain, vm, &def, &snap,
+                                          &update_current, flags) < 0)
             goto cleanup;
     } else {
         if (!(def->dom = virDomainDefCopy(vm->def,
@@ -7078,6 +7073,8 @@ cleanup:
         testDomainEventQueue(privconn, event);
         if (event2)
             testDomainEventQueue(privconn, event2);
+    } else {
+        virDomainEventFree(event2);
     }
     virObjectUnlock(vm);
     testDriverUnlock(privconn);
-- 
1.8.3.1

--
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]