From: Donghwa Jeong Date: Thu, 14 Jun 2018 01:36:46 +0000 (+0900) Subject: coverity: #1436916 X-Git-Tag: lxc-2.0.10~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1cd0852575fc4d52665b0d8287e33c24da849b;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 5e1775f5e..38594a492 100644 --- a/src/lxc/tools/lxc_unshare.c +++ b/src/lxc/tools/lxc_unshare.c @@ -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) {