]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools/utils: free memory on error
authorC0deAi <benjamin.bales@assrc.us>
Fri, 6 Apr 2018 16:56:50 +0000 (12:56 -0400)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 9 Apr 2018 18:40:13 +0000 (20:40 +0200)
Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/tool_utils.c

index ca325456aaf8556685d0b46326a7ace9a35bb106..71e5036be1bf610f2ac8f420c6b9ef1adabcab0c 100644 (file)
@@ -794,8 +794,11 @@ int lxc_config_define_add(struct lxc_list *defines, char *arg)
                return -1;
 
        dent->elem = parse_line(arg);
-       if (!dent->elem)
+       if (!dent->elem) {
+               free(dent);
                return -1;
+       }
+
        lxc_list_add_tail(defines, dent);
        return 0;
 }