]> git.proxmox.com Git - mirror_lxc.git/commitdiff
coverity: #1425813
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Jun 2018 09:49:10 +0000 (11:49 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Jun 2018 10:38:14 +0000 (12:38 +0200)
Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_ls.c

index c152d61551f13dc28e3e54e85fb2cdfa0dd6cdf7..4604d1ac94b60e61be9d036a29f9dded1782d1a2 100644 (file)
@@ -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);