]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Merge pull request #2399 from 2xsec/bugfix
authorChristian Brauner <christian@brauner.io>
Thu, 14 Jun 2018 06:37:25 +0000 (08:37 +0200)
committerGitHub <noreply@github.com>
Thu, 14 Jun 2018 06:37:25 +0000 (08:37 +0200)
coverity: #1436916

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) {