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

Jie Wang posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1496999554-60599-1-git-send-email-wangjie88@huawei.com
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] qemuDomainBlockCopyCommon: Fix the memory leak
Posted by Jie Wang 6 years, 10 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuDomainBlockCopyCommon: Fix the memory leak
Posted by Andrea Bolognani 6 years, 10 months ago
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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuDomainBlockCopyCommon: Fix the memory leak
Posted by Andrea Bolognani 6 years, 10 months ago
On Fri, 2017-06-09 at 17:17 +0200, Andrea Bolognani wrote:
> Looks reasonable. I'll push it on Monday unless someone raises
> concerns in the meantime.

Reworded the commit message and pushed.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list