qemu: Do not release device address on successful RNG attach

Commit id '980b265d' neglected to check for a successful status when
deciding whether to release the device address for the RNG attach thus
the address would be released even though the device was added.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
This commit is contained in:
Luyao Huang 2015-05-31 19:29:46 +08:00 committed by John Ferlan
parent 731d9cf251
commit 0ed3b33535

View File

@ -1695,7 +1695,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
audit:
virDomainAuditRNG(vm, NULL, rng, "attach", ret == 0);
cleanup:
if (vm)
if (ret < 0 && vm)
qemuDomainReleaseDeviceAddress(vm, &rng->info, NULL);
VIR_FREE(charAlias);
VIR_FREE(objAlias);