[libvirt] [PATCH] mpath: Fix memory leak in virStorageBackendCreateVols

ZhiPeng Lu posted 1 patch 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1500424614-17222-1-git-send-email-lu.zhipeng@zte.com.cn
src/storage/storage_backend_mpath.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] mpath: Fix memory leak in virStorageBackendCreateVols
Posted by ZhiPeng Lu 6 years, 8 months ago
@map_device, allocated by virAsprintf in virStorageBackendCreateVols,
was not freed and leaked.

Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>
---
 src/storage/storage_backend_mpath.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 606b399..434a477 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -200,6 +200,7 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
 
     retval = 0;
  out:
+    VIR_FREE(map_device);
     return retval;
 }
 
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] mpath: Fix memory leak in virStorageBackendCreateVols
Posted by Michal Privoznik 6 years, 8 months ago
On 07/19/2017 02:36 AM, ZhiPeng Lu wrote:
> @map_device, allocated by virAsprintf in virStorageBackendCreateVols,
> was not freed and leaked.
> 
> Signed-off-by: Zhipeng Lu <lu.zhipeng@zte.com.cn>
> ---
>  src/storage/storage_backend_mpath.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
> index 606b399..434a477 100644
> --- a/src/storage/storage_backend_mpath.c
> +++ b/src/storage/storage_backend_mpath.c
> @@ -200,6 +200,7 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
>  
>      retval = 0;
>   out:
> +    VIR_FREE(map_device);
>      return retval;
>  }
>  
> 

ACKed and pushed.

Michal

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