mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user