Avoid calling fclose(NULL) if the sudoers file is not secure and
restore_perms() fails. Coverity CID 104090.
This commit is contained in:
@@ -939,8 +939,10 @@ open_sudoers(const char *sudoers, bool doedit, bool *keepopen)
|
||||
|
||||
if (!restore_perms()) {
|
||||
/* unable to change back to root */
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
if (fp != NULL) {
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_return_ptr(fp);
|
||||
|
Reference in New Issue
Block a user