8150379: [windows] Fix Leaks in perfMemory_windows.cpp
Reviewed-by: clanger, dholmes, gthornbr
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp Tue Feb 23 14:14:29 2016 +0100
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp Tue Feb 23 19:10:01 2016 -0500
@@ -628,6 +628,7 @@
if (!is_directory_secure(dirname)) {
// the directory is not secure, don't attempt any cleanup
+ os::closedir(dirp);
return;
}
@@ -1445,6 +1446,8 @@
// check that the file system is secure - i.e. it supports ACLs.
if (!is_filesystem_secure(dirname)) {
+ FREE_C_HEAP_ARRAY(char, dirname);
+ FREE_C_HEAP_ARRAY(char, user);
return NULL;
}
@@ -1624,6 +1627,7 @@
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
+ if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}