[lxc-devel] [PATCH] conffile.c: Also clear text entries with no value
Stéphane Graber
stgraber at ubuntu.com
Thu Dec 5 22:45:38 UTC 2013
Signed-off-by: Stéphane Graber <stgraber 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
More information about the lxc-devel
mailing list