提交 986152e0 编写于 作者: P Peter Krempa

qemu: hotplug: Don't leak saved error on failure in qemuHotplugRemoveManagedPR

If we'd fail to enter or exit the monitor the saved error would be
leaked. Introduced in 8498a1e2 .

Pointed out by coverity.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 5f02e284
...@@ -354,22 +354,26 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver, ...@@ -354,22 +354,26 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver,
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virErrorPtr orig_err; virErrorPtr orig_err;
virErrorPreserveLast(&orig_err); int ret = -1;
if (!priv->prDaemonRunning || if (!priv->prDaemonRunning ||
virDomainDefHasManagedPR(vm->def)) virDomainDefHasManagedPR(vm->def))
return 0; return 0;
virErrorPreserveLast(&orig_err);
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1; goto cleanup;
ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias())); ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias()));
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -1; goto cleanup;
qemuProcessKillManagedPRDaemon(vm); qemuProcessKillManagedPRDaemon(vm);
virErrorRestore(&orig_err);
return 0; ret = 0;
cleanup:
virErrorRestore(&orig_err);
return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册