From: Christian Brauner Date: Fri, 15 Jun 2018 09:49:10 +0000 (+0200) Subject: coverity: #1425813 X-Git-Tag: lxc-2.0.10~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b4803b42a5be8016080f1cc76bff0d685ee95d5;p=thirdparty%2Flxc.git coverity: #1425813 Resource leak Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c index a7e0ed220..7f170e8c3 100644 --- a/src/lxc/tools/lxc_ls.c +++ b/src/lxc/tools/lxc_ls.c @@ -561,8 +561,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);