Re: [PATCH 1/2] virStorageBackendRBDGetVolNames: Fix memory leak in 'rbd_list2' version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/15/21 4:16 PM, Peter Krempa wrote:
> The 'rbd_image_spec_t' struct has two string members 'id' and
> 'name'. We only stole the 'name' members thus the 'id's as well as the
> whole list would be leaked on success.
> 
> Restructure the code so that we copy out the image names and call
> rbd_image_spec_list_cleanup on success rather than on error.
> 
> The error path is then handled by using g_autofree for 'images'.
> 
> Since we no longer have a error path after allocating the returned
> string list we can completely remove it's cleanup.

*its

> 
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/storage/storage_backend_rbd.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux