In sudo_edit_create_tfiles(), fix fd leak if sudo_edit_mktemp() fails.

Coverity CID 104114.
This commit is contained in:
Todd C. Miller
2016-05-07 05:10:11 -06:00
parent 355cce4570
commit e99e3c26c8

View File

@@ -558,6 +558,8 @@ sudo_edit_create_tfiles(struct command_details *command_details,
sudo_fatal("seteuid(ROOT_UID)"); sudo_fatal("seteuid(ROOT_UID)");
if (tfd == -1) { if (tfd == -1) {
sudo_warn("mkstemps"); sudo_warn("mkstemps");
if (ofd != -1)
close(ofd);
debug_return_int(-1); debug_return_int(-1);
} }
if (ofd != -1) { if (ofd != -1) {