8150379: [windows] Fix Leaks in perfMemory_windows.cpp
authorstuefe
Tue, 23 Feb 2016 19:10:01 -0500
changeset 36204 1c9f2970da66
parent 36203 15f303aa8d7f
child 36205 921d57edce3e
child 36353 28b633a6919d
8150379: [windows] Fix Leaks in perfMemory_windows.cpp Reviewed-by: clanger, dholmes, gthornbr
hotspot/src/os/windows/vm/perfMemory_windows.cpp
--- 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");
   }