[libvirt] [PATCH] qemuDomainBlockCopyCommon: Fix the memory leak

When take the cleanup branch, will leads to the mirror memory leak --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1e3c7fc..74cc2c4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16856,7 +16856,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, endjob: if (need_unlink && unlink(mirror->path)) VIR_WARN("unable to unlink just-created %s", mirror->path); - virStorageSourceFree(mirror); qemuDomainObjEndJob(driver, vm); if (monitor_error) { virSetError(monitor_error); @@ -16866,6 +16865,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, cleanup: VIR_FREE(device); virObjectUnref(cfg); + virStorageSourceFree(mirror); return ret; } -- 1.8.3.1

Not sure why you decided to CC: me, especially considering that I've never touched the code in question; it's not the first time that's happened, either. Please don't CC: random developers when posting patches. On Fri, 2017-06-09 at 17:12 +0800, Jie Wang wrote:
When take the cleanup branch, will leads to the mirror memory leak --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1e3c7fc..74cc2c4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16856,7 +16856,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, endjob: if (need_unlink && unlink(mirror->path)) VIR_WARN("unable to unlink just-created %s", mirror->path); - virStorageSourceFree(mirror); qemuDomainObjEndJob(driver, vm); if (monitor_error) { virSetError(monitor_error); @@ -16866,6 +16865,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, cleanup: VIR_FREE(device); virObjectUnref(cfg); + virStorageSourceFree(mirror); return ret; }
Looks reasonable. I'll push it on Monday unless someone raises concerns in the meantime. Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Jie Wang