[lxc-devel] [PATCH] conffile.c: Also clear text entries with no value

Serge Hallyn serge.hallyn at ubuntu.com
Fri Dec 6 14:54:49 UTC 2013


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

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

> ---
>  src/lxc/confile.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> index 835153b..5f25e08 100644
> --- a/src/lxc/confile.c
> +++ b/src/lxc/confile.c
> @@ -216,8 +216,12 @@ static int config_string_item(char **conf_item, const char *value)
>  {
>  	char *new_value;
>  
> -	if (!value || strlen(value) == 0)
> +	if (!value || strlen(value) == 0) {
> +		if (*conf_item)
> +			free(*conf_item);
> +		*conf_item = NULL;
>  		return 0;
> +	}
>  
>  	new_value = strdup(value);
>  	if (!new_value) {
> -- 
> 1.8.5.1
> 
> 
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK 
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list