Merge pull request from ikerexxe/rest_resource_leak

Fix covscan RESOURCE_LEAK
This commit is contained in:
Serge Hallyn
2021-06-24 13:14:15 -05:00
committed by GitHub
10 changed files with 33 additions and 4 deletions

@@ -162,8 +162,9 @@ static void check_perms (const struct group *grp,
*/
spwd = xgetspnam (pwd->pw_name);
if (NULL != spwd) {
pwd->pw_passwd = spwd->sp_pwdp;
pwd->pw_passwd = xstrdup (spwd->sp_pwdp);
}
spw_free (spwd);
if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) {
needspasswd = true;

@@ -553,6 +553,11 @@ static char *update_crypt_pw (char *cp)
strcpy (newpw, "!");
strcat (newpw, cp);
#ifndef USE_PAM
if (do_update_pwd) {
free (cp);
}
#endif /* USE_PAM */
cp = newpw;
}
return cp;