2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Fix fd leak in sudo_krb5_copy_cc_file() if restore_perms() fails.

Coverity CID 104571.
This commit is contained in:
Todd C. Miller
2016-05-07 07:49:35 -06:00
parent b84b2e6805
commit 334b8f36a8

View File

@@ -2596,8 +2596,10 @@ sudo_krb5_copy_cc_file(const char *old_ccname)
if (!set_perms(PERM_USER))
goto done;
ofd = open(old_ccname, O_RDONLY|O_NONBLOCK);
if (!restore_perms())
if (!restore_perms()) {
close(ofd);
goto done;
}
if (ofd != -1) {
(void) fcntl(ofd, F_SETFL, 0);