]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conffile.c: Also clear text entries with no value
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 5 Dec 2013 22:13:18 +0000 (17:13 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 6 Dec 2013 16:21:13 +0000 (11:21 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/confile.c

index 835153b86c6d7d8f34a400bdabfe6e5b088a72db..5f25e08ce5b1d1101396bebb262c792bc1e2235c 100644 (file)
@@ -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) {