From 0ed3b3353593792da2104dd3b8a27a2b6a240300 Mon Sep 17 00:00:00 2001 From: Luyao Huang Date: Sun, 31 May 2015 19:29:46 +0800 Subject: [PATCH] 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 --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f596730894..94ebe35ddd 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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);