Skip to content

Commit

Permalink
tools/utils: free memory on error
Browse files Browse the repository at this point in the history
Closes lxc#2262.

Signed-off-by: C0deAi <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
C0deAi authored and Christian Brauner committed Apr 9, 2018
1 parent 55d83a7 commit 7426904
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxc/tools/tool_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7426904

Please sign in to comment.