From cdba253fe248594af82b77a4233411a1521e8c6e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 15 Jun 2018 11:49:10 +0200 Subject: [PATCH] coverity: #1425813 Resource leak Signed-off-by: Christian Brauner --- src/lxc/tools/lxc_ls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c index c152d6155..4604d1ac9 100644 --- a/src/lxc/tools/lxc_ls.c +++ b/src/lxc/tools/lxc_ls.c @@ -568,8 +568,10 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args, /* We want to remove all locks we create under * /run/lxc/lock so we create a string pointing us to * the lock path for the current container. */ - if (ls_remove_lock(path, name, lockpath, &len_lockpath, true) == -1) + if (ls_remove_lock(path, name, lockpath, &len_lockpath, true) == -1) { + free(newpath); goto put_and_next; + } ls_get(m, size, args, newpath, l->name, lvl + 1, lockpath, len_lockpath, grps_must, grps_must_len); free(newpath); -- 2.47.2