mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8006001: [parfait] Possible file leak in hotspot/src/os/linux/vm/perfMemory_linux.cpp
Reviewed-by: zgu, coleenp, hseigel, dholmes
This commit is contained in:
parent
eeb83733a6
commit
a72b5d24e6
4 changed files with 35 additions and 23 deletions
|
@ -672,15 +672,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
|
|||
RESTARTABLE(::open(filename, oflags), result);
|
||||
if (result == OS_ERR) {
|
||||
if (errno == ENOENT) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Process not found");
|
||||
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Process not found", OS_ERR);
|
||||
}
|
||||
else if (errno == EACCES) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Permission denied");
|
||||
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Permission denied", OS_ERR);
|
||||
}
|
||||
else {
|
||||
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
|
||||
THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,7 +828,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
|||
char* mapAddress;
|
||||
int result;
|
||||
int fd;
|
||||
size_t size;
|
||||
size_t size = 0;
|
||||
const char* luser = NULL;
|
||||
|
||||
int mmap_prot;
|
||||
|
@ -899,9 +899,12 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
|||
|
||||
if (*sizep == 0) {
|
||||
size = sharedmem_filesize(fd, CHECK);
|
||||
assert(size != 0, "unexpected size");
|
||||
} else {
|
||||
size = *sizep;
|
||||
}
|
||||
|
||||
assert(size > 0, "unexpected size <= 0");
|
||||
|
||||
mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
|
||||
|
||||
// attempt to close the file - restart if it gets interrupted,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue