Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
This commit is contained in:
Donghwa Jeong 2018-06-14 10:36:46 +09:00
parent 2b65c74cf9
commit db8b325a3c
No known key found for this signature in database
GPG Key ID: 0BE2750EE612F372

View File

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