changeset 6464:30869b0daa3e

8028749: java -version crashes with 'fatal error: heap walk aborted with error 1' Summary: check_heap() should only call HeapWalk() when HeapLock() is successful. Reviewed-by: ctornqvi, sla, dcubed
author rdurbin
date Thu, 15 May 2014 10:44:20 -0700
parents cb82a30966ac
children 47b707b6c4e7
files src/os/windows/vm/os_windows.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/windows/vm/os_windows.cpp	Thu May 15 09:25:27 2014 -0400
+++ b/src/os/windows/vm/os_windows.cpp	Thu May 15 10:44:20 2014 -0700
@@ -5005,7 +5005,11 @@
     // wrong; at these points, eax contains the address of the offending block (I think).
     // To get to the exlicit error message(s) below, just continue twice.
     HANDLE heap = GetProcessHeap();
-    { HeapLock(heap);
+
+    // If we fail to lock the heap, then gflags.exe has been used
+    // or some other special heap flag has been set that prevents
+    // locking. We don't try to walk a heap we can't lock.
+    if (HeapLock(heap) != 0) {
       PROCESS_HEAP_ENTRY phe;
       phe.lpData = NULL;
       while (HeapWalk(heap, &phe) != 0) {