提交 a73c67b6 编写于 作者: J John Ferlan

qemu: Resolve Coverity RESOURCE_LEAK

This seemed to be more of a false positive as for some reason Coverity
was missing the "ret < 0" goto error condition and somehow believing that
event could be overwritten.  At first I thought it was just the ret != 0
condition difference, but it wasn't.

In any case, make use of the recent change to qemuDomainEventQueue to
check event == NULL and just pass it as a parameter directly in the
error path. That avoids the error.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 83cbbbef
...@@ -3175,7 +3175,6 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, ...@@ -3175,7 +3175,6 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
char *xml = NULL; char *xml = NULL;
bool was_running = false; bool was_running = false;
int ret = -1; int ret = -1;
int rc;
virObjectEventPtr event = NULL; virObjectEventPtr event = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virCapsPtr caps; virCapsPtr caps;
...@@ -3256,14 +3255,14 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, ...@@ -3256,14 +3255,14 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
if (ret < 0) { if (ret < 0) {
if (was_running && virDomainObjIsActive(vm)) { if (was_running && virDomainObjIsActive(vm)) {
virErrorPtr save_err = virSaveLastError(); virErrorPtr save_err = virSaveLastError();
rc = qemuProcessStartCPUs(driver, vm, dom->conn, if (qemuProcessStartCPUs(driver, vm, dom->conn,
VIR_DOMAIN_RUNNING_SAVE_CANCELED, VIR_DOMAIN_RUNNING_SAVE_CANCELED,
QEMU_ASYNC_JOB_SAVE); QEMU_ASYNC_JOB_SAVE) < 0) {
if (rc < 0) {
VIR_WARN("Unable to resume guest CPUs after save failure"); VIR_WARN("Unable to resume guest CPUs after save failure");
event = virDomainEventLifecycleNewFromObj(vm, qemuDomainEventQueue(driver,
virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR));
} }
virSetError(save_err); virSetError(save_err);
virFreeError(save_err); virFreeError(save_err);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册