[lxc-devel] [PATCH] Remove unnecessary call to free()

Serge Hallyn serge.hallyn at ubuntu.com
Mon Sep 28 20:57:32 UTC 2015


Quoting Christian Brauner (christianvanbrauner at gmail.com):
> Freeing memory when calloc() fails doesn't make sense
> 
> Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/lxc_destroy.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c
> index 0eeff51..f1830fd 100644
> --- a/src/lxc/lxc_destroy.c
> +++ b/src/lxc/lxc_destroy.c
> @@ -168,7 +168,6 @@ static int do_destroy_with_snapshots(struct lxc_container *c)
>  		if (!buf) {
>  			SYSERROR("failed to allocate memory");
>  			close(fd);
> -			free(buf);
>  			return -1;
>  		}
>  
> -- 
> 2.5.3
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list