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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user