[libvirt] [PATCH] esx: Fix memory leak

Wang King posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170412100644.5112-1-king.wang@huawei.com
src/esx/esx_storage_backend_vmfs.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] esx: Fix memory leak
Posted by Wang King 6 years, 11 months ago
Variable def going out of scope leaks the storage def.source.hosts points to.
---
 src/esx/esx_storage_backend_vmfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index a1a660b..940e5d1 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -513,6 +513,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
     xml = virStoragePoolDefFormat(&def);
 
  cleanup:
+    VIR_FREE(def.source.hosts);
     esxVI_String_Free(&propertyNameList);
     esxVI_ObjectContent_Free(&datastore);
     esxVI_DatastoreHostMount_Free(&hostMount);
-- 
2.8.3


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] esx: Fix memory leak
Posted by John Ferlan 6 years, 11 months ago

On 04/12/2017 06:06 AM, Wang King wrote:
> Variable def going out of scope leaks the storage def.source.hosts points to.
> ---
>  src/esx/esx_storage_backend_vmfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 

ACK (and will push shortly)

John

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