]>
Commit | Line | Data |
---|---|---|
99be5c8c WB |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: C0deAi <benjamin.bales@assrc.us> | |
3 | Date: Fri, 6 Apr 2018 12:56:50 -0400 | |
4 | Subject: [PATCH] tools/utils: free memory on error | |
5 | ||
6 | Closes #2262. | |
7 | ||
8 | Signed-off-by: C0deAi <techsupport@mycode.ai> | |
9 | Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> | |
10 | --- | |
11 | src/lxc/tools/tool_utils.c | 5 ++++- | |
12 | 1 file changed, 4 insertions(+), 1 deletion(-) | |
13 | ||
14 | diff --git a/src/lxc/tools/tool_utils.c b/src/lxc/tools/tool_utils.c | |
15 | index ca325456..71e5036b 100644 | |
16 | --- a/src/lxc/tools/tool_utils.c | |
17 | +++ b/src/lxc/tools/tool_utils.c | |
18 | @@ -794,8 +794,11 @@ int lxc_config_define_add(struct lxc_list *defines, char *arg) | |
19 | return -1; | |
20 | ||
21 | dent->elem = parse_line(arg); | |
22 | - if (!dent->elem) | |
23 | + if (!dent->elem) { | |
24 | + free(dent); | |
25 | return -1; | |
26 | + } | |
27 | + | |
28 | lxc_list_add_tail(defines, dent); | |
29 | return 0; | |
30 | } | |
31 | -- | |
32 | 2.11.0 | |
33 |