From: Donghwa Jeong Date: Thu, 14 Jun 2018 01:36:46 +0000 (+0900) Subject: coverity: #1436916 X-Git-Tag: lxc-3.1.0~252^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2399%2Fhead;p=thirdparty%2Flxc.git coverity: #1436916 Resource leak Signed-off-by: Donghwa Jeong --- diff --git a/src/lxc/tools/lxc_unshare.c b/src/lxc/tools/lxc_unshare.c index eb69068af..699823bff 100644 --- a/src/lxc/tools/lxc_unshare.c +++ b/src/lxc/tools/lxc_unshare.c @@ -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) {