8187578: BitMap::reallocate should check if old_map is NULL
authorehelin
Fri, 15 Sep 2017 14:47:13 +0200
changeset 47616 4f26db3c02af
parent 47615 6210a27c3704
child 47617 44117bc2bedf
8187578: BitMap::reallocate should check if old_map is NULL Reviewed-by: stefank, eosterlund, dholmes
src/hotspot/share/utilities/bitMap.cpp
--- a/src/hotspot/share/utilities/bitMap.cpp	Tue Oct 10 19:18:36 2017 -0700
+++ b/src/hotspot/share/utilities/bitMap.cpp	Fri Sep 15 14:47:13 2017 +0200
@@ -81,8 +81,10 @@
   if (new_size_in_words > 0) {
     map = allocator.allocate(new_size_in_words);
 
-    Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map,
-                         MIN2(old_size_in_words, new_size_in_words));
+    if (old_map != NULL) {
+      Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map,
+                           MIN2(old_size_in_words, new_size_in_words));
+    }
 
     if (new_size_in_words > old_size_in_words) {
       clear_range_of_words(map, old_size_in_words, new_size_in_words);