From: Christian Brauner Date: Fri, 15 Jun 2018 09:54:14 +0000 (+0200) Subject: coverity: #1425819 X-Git-Tag: lxc-2.0.10~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8d6490b5abe3809000fb18a92ffcc43148320c8;p=thirdparty%2Flxc.git coverity: #1425819 Resource leak Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c index 7f170e8c3..5c86d5d07 100644 --- a/src/lxc/tools/lxc_ls.c +++ b/src/lxc/tools/lxc_ls.c @@ -803,10 +803,11 @@ static void ls_print_fancy_format(struct ls *l, struct lengths *lht, /* Check for invalid keys. */ for (s = tmp; s && *s; s++) { if (strcasecmp(*s, "NAME") && strcasecmp(*s, "STATE") && - strcasecmp(*s, "PID") && strcasecmp(*s, "RAM") && - strcasecmp(*s, "SWAP") && strcasecmp(*s, "AUTOSTART") && - strcasecmp(*s, "GROUPS") && strcasecmp(*s, "INTERFACE") && - strcasecmp(*s, "IPV4") && strcasecmp(*s, "IPV6")) { + strcasecmp(*s, "PID") && strcasecmp(*s, "RAM") && + strcasecmp(*s, "SWAP") && strcasecmp(*s, "AUTOSTART") && + strcasecmp(*s, "GROUPS") && strcasecmp(*s, "INTERFACE") && + strcasecmp(*s, "IPV4") && strcasecmp(*s, "IPV6")) { + lxc_free_array((void **)tmp, free); fprintf(stderr, "Invalid key: %s\n", *s); return; } @@ -879,6 +880,8 @@ static void ls_print_fancy_format(struct ls *l, struct lengths *lht, } printf("\n"); } + + lxc_free_array((void **)tmp, free); } static void ls_print_table(struct ls *l, struct lengths *lht,