]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
test: Fix coverity warnings
authorCole Robinson <crobinso@redhat.com>
Fri, 4 Oct 2013 12:48:39 +0000 (08:48 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 4 Oct 2013 14:06:56 +0000 (10:06 -0400)
src/test/test_driver.c

index 255cc2b5c51cd0324feea135bf11110be1913c9b..c2e530ef2214a2f00752cf064851fc8c7e221ea9 100644 (file)
@@ -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);