]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1436916
authorDonghwa Jeong <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 01:36:46 +0000 (10:36 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 08:15:55 +0000 (09:15 +0100)
Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
src/lxc/tools/lxc_unshare.c

index 5e1775f5eaa22d3aaec00b51c717c12be42591f3..38594a492a63ce04077f2b6d4a021f261e5d8c94 100644 (file)
@@ -87,8 +87,10 @@ static bool lookup_user(const char *optarg, uid_t *uid)
 
        if (sscanf(optarg, "%u", uid) < 1) {
                /* not a uid -- perhaps a username */
-               if (sscanf(optarg, "%s", name) < 1)
+               if (sscanf(optarg, "%s", name) < 1) {
+                       free(buf);
                        return false;
+               }
 
                ret = getpwnam_r(name, &pwent, buf, bufsize, &pwentp);
                if (!pwentp) {