]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1436916 2399/head
authorDonghwa Jeong <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 01:36:46 +0000 (10:36 +0900)
committerDonghwa Jeong <dh48.jeong@samsung.com>
Thu, 14 Jun 2018 01:36:46 +0000 (10:36 +0900)
Resource leak

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

index eb69068afda787251f18ca74e050fed07942bd2e..699823bff7d1ed84f0a09c6a21509096775481bd 100644 (file)
@@ -101,8 +101,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) {