[libvirt] [PATCH] qemu: fix wrong call addressrelease function when attach RNG device success

Luyao Huang lhuang at redhat.com
Sun May 31 11:29:46 UTC 2015


Add a return value check to avoid the wrong address release.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 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 170768b..f70e3d8 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);
-- 
1.8.3.1




More information about the libvir-list mailing list