[Libguestfs] [PATCH] btrfs: use CLEANUP_FREE_STRING_LIST for list free

Pino Toscano ptoscano at redhat.com
Fri Jun 12 09:14:23 UTC 2015


On Friday 12 June 2015 11:27:22 Chen Hanxiao wrote:
> As Pino's comment, we should take advantage of
> macro CLEANUP_FREE_STRING_LIST.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  daemon/btrfs.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index 39392f7..fd93d43 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -409,7 +409,7 @@ umount (char *fs_buf, const mountable_t *fs)
>  guestfs_int_btrfssubvolume_list *
>  do_btrfs_subvolume_list (const mountable_t *fs)
>  {
> -  char **lines;
> +  CLEANUP_FREE_STRING_LIST char **lines;

Usually, pointer variables marked as CLEANUP_* need to be reset,
otherwise the cleanup routine will try to free uninitialized memory.

Thanks,
-- 
Pino Toscano




More information about the Libguestfs mailing list