8313691: use close after failing os::fdopen in vmError and ciEnv

Reviewed-by: dholmes, thartmann
This commit is contained in:
Matthias Baesken 2023-08-09 06:54:15 +00:00
parent 3fb4805b1a
commit 96304f37f8
2 changed files with 3 additions and 0 deletions
src/hotspot/share

@ -1710,6 +1710,7 @@ void ciEnv::dump_replay_data(int compile_id) {
tty->print_cr("# Compiler replay data is saved as: %s", buffer);
} else {
tty->print_cr("# Can't open file to dump replay data.");
close(fd);
}
}
}
@ -1734,6 +1735,7 @@ void ciEnv::dump_inline_data(int compile_id) {
tty->print_cr("%s", buffer);
} else {
tty->print_cr("# Can't open file to dump inline data.");
close(fd);
}
}
}

@ -1841,6 +1841,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
int e = errno;
out.print_raw("#\n# Can't open file to dump replay data. Error: ");
out.print_raw_cr(os::strerror(e));
close(fd);
}
}
}