diff src/os/windows/vm/perfMemory_windows.cpp @ 9064:4b7cf00ccb08

8006001: [parfait] Possible file leak in hotspot/src/os/linux/vm/perfMemory_linux.cpp Reviewed-by: zgu, coleenp, hseigel, dholmes
author ccheung
date Fri, 05 Apr 2013 11:15:13 -0700
parents 716c64bda5ba
children a837fa3d3f86
line wrap: on
line diff
--- a/src/os/windows/vm/perfMemory_windows.cpp	Thu Apr 04 10:01:26 2013 -0700
+++ b/src/os/windows/vm/perfMemory_windows.cpp	Fri Apr 05 11:15:13 2013 -0700
@@ -1581,7 +1581,7 @@
   ResourceMark rm;
 
   void *mapAddress = 0;
-  size_t size;
+  size_t size = 0;
   HANDLE fmh;
   DWORD ofm_access;
   DWORD mv_access;
@@ -1652,9 +1652,12 @@
 
   if (*sizep == 0) {
     size = sharedmem_filesize(rfilename, CHECK);
-    assert(size != 0, "unexpected size");
+  } else {
+    size = *sizep;
   }
 
+  assert(size > 0, "unexpected size <= 0");
+
   // Open the file mapping object with the given name
   fmh = open_sharedmem_object(robjectname, ofm_access, CHECK);