[sheepdog] [PATCH] dog/vdi: fix memory leak in dog vdi command

Liu Yuan namei.unix at gmail.com
Tue Apr 22 10:50:06 CEST 2014


On Tue, Apr 22, 2014 at 04:28:34PM +0800, Ruoyu wrote:
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/vdi.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index db5fc58..1851a2a 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -790,6 +790,7 @@ static int vdi_object_map(int argc, char **argv)
>  			   SD_INODE_SIZE);
>  	if (ret != EXIT_SUCCESS) {
>  		sd_err("FATAL: %s not found", vdiname);
> +		free(inode);
>  		return ret;
>  	}
>  
> @@ -1750,10 +1751,13 @@ static int vdi_check(int argc, char **argv)
>  			   SD_INODE_SIZE);
>  	if (ret != EXIT_SUCCESS) {
>  		sd_err("FATAL: no inode objects");
> -		return ret;
> +		goto out;
>  	}
>  
> -	return do_vdi_check(inode);
> +	ret = do_vdi_check(inode);
> +out:
> +	free(inode);
> +	return ret;
>  }
>  
>  /* vdi backup format */
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied thanks

Yuan



More information about the sheepdog mailing list