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

Add a return value check to avoid the wrong address release. Signed-off-by: Luyao Huang <lhuang@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

On 05/31/2015 07:29 AM, Luyao Huang wrote:
Add a return value check to avoid the wrong address release.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK - although I'll make an adjustment to the commit message before pushing John

On 06/03/2015 02:04 AM, John Ferlan wrote:
On 05/31/2015 07:29 AM, Luyao Huang wrote:
Add a return value check to avoid the wrong address release.
Signed-off-by: Luyao Huang <lhuang@redhat.com> --- src/qemu/qemu_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK - although I'll make an adjustment to the commit message before pushing
Thanks a lot for your help and review
John
Luyao
participants (3)
-
John Ferlan
-
lhuang
-
Luyao Huang