On 06/25/2018 04:15 PM, w00251574 wrote:
Subject: [PATCH] qemu: Fix memory leak in
qemuDomainBlockJobSetSpeed()
fix 'device' leak in qemuDomainBlockJobSetSpeed
Signed-off-by: Jie Wang <wangjie88.huawei.com>
---
src/qemu/qemu_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 921aafcd79..b45c26eb3b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17395,6 +17395,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom,
qemuDomainObjEndJob(driver, vm);
cleanup:
+ VIR_FREE(device);
virDomainObjEndAPI(&vm);
return ret;
Almost. @device is type of 'const char *' and that needs to change (one
should never free a const string). Secondly, with this change there are
multiple ways to get to @cleanup label without @device being set to
anything (and thus we might end up freeing random pointer).
Fixed and pushed.
Michal