From: Cole Robinson Date: Fri, 4 Oct 2013 12:48:39 +0000 (-0400) Subject: test: Fix coverity warnings X-Git-Tag: CVE-2013-4401~145 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc9ff1f24965d4759d7277a7f3b1697b98e929a6;p=thirdparty%2Flibvirt.git test: Fix coverity warnings --- diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 255cc2b5c5..c2e530ef22 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);