mirror of https://gitee.com/openkylin/libvirt.git
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 8498a1e222
.
Pointed out by coverity.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
5f02e28480
commit
986152e004
|
@ -354,22 +354,26 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver,
|
|||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virErrorPtr orig_err;
|
||||
virErrorPreserveLast(&orig_err);
|
||||
int ret = -1;
|
||||
|
||||
if (!priv->prDaemonRunning ||
|
||||
virDomainDefHasManagedPR(vm->def))
|
||||
return 0;
|
||||
|
||||
virErrorPreserveLast(&orig_err);
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias()));
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
|
||||
qemuProcessKillManagedPRDaemon(vm);
|
||||
virErrorRestore(&orig_err);
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virErrorRestore(&orig_err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue