[sheepdog] [PATCH v3] dog/farm/slice: fix memory leak in dog cluster snapshot load command

Liu Yuan namei.unix at gmail.com
Thu Apr 24 05:08:38 CEST 2014


On Wed, Apr 23, 2014 at 05:47:05PM +0800, Ruoyu wrote:
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/farm/slice.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dog/farm/slice.c b/dog/farm/slice.c
> index 77db771..16451a0 100644
> --- a/dog/farm/slice.c
> +++ b/dog/farm/slice.c
> @@ -102,10 +102,12 @@ void *slice_read(const unsigned char *sha1, size_t *outsize)
>  
>  	object = xmalloc(*outsize);
>  	strbuf_copyout(&buf, object, *outsize);
> +	free(file->slices);
>  	free(file);
>  	strbuf_release(&buf);
>  	return object;
>  err:
> +	free(file->slices);
>  	free(file);
>  	strbuf_release(&buf);
>  	return NULL;
> -- 
> 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