xfs
[Top] [All Lists]

Re: [PATCH 1/6] xfs_io: free fshandlep in parent_check()

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: Re: [PATCH 1/6] xfs_io: free fshandlep in parent_check()
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 5 Aug 2014 09:16:05 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1406905159-12415-2-git-send-email-sandeen@xxxxxxxxxx>
References: <1406905159-12415-1-git-send-email-sandeen@xxxxxxxxxx> <1406905159-12415-2-git-send-email-sandeen@xxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Fri, Aug 01, 2014 at 09:59:14AM -0500, Eric Sandeen wrote:
> The allocated fshandle wasn't freed in either normal
> exit or error paths.
> 
> Do this, and consolidate cleanup into an out: target.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  io/parent.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/io/parent.c b/io/parent.c
> index ca989e9..56e126d 100644
> --- a/io/parent.c
> +++ b/io/parent.c
> @@ -258,9 +258,8 @@ parent_check(void)
>       if (!bstatbuf || !parentbuf) {
>               fprintf(stderr, _("unable to allocate buffers: %s\n"),
>                       strerror(errno));
> -             free(bstatbuf);
> -             free(parentbuf);
> -             return 1;
> +             err_status = 1;
> +             goto out;
>       }
>  
>       if (do_bulkstat(parentbuf, &parentbuf_size, bstatbuf, fsfd, fshandlep) 
> != 0)
> @@ -272,8 +271,10 @@ parent_check(void)
>               printf(_("succeeded checking %llu inodes\n"),
>                       (unsigned long long) inodes_checked);
>  
> +out:
>       free(bstatbuf);
>       free(parentbuf);
> +     free(fshandlep);
>       return err_status;
>  }
>  
> -- 
> 1.7.1
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>