8098517: Unprotected PrintMalloc in os::realloc
authorkbarrett
Mon, 15 Jun 2015 01:38:42 -0400
changeset 31347 0fec61c9d330
parent 31346 a70d45c06136
child 31348 c28f02c7abb5
8098517: Unprotected PrintMalloc in os::realloc Summary: Also verify tty != NULL before printing. Reviewed-by: dholmes
hotspot/src/share/vm/runtime/os.cpp
--- a/hotspot/src/share/vm/runtime/os.cpp	Fri Jun 12 19:49:54 2015 -0400
+++ b/hotspot/src/share/vm/runtime/os.cpp	Mon Jun 15 01:38:42 2015 -0400
@@ -670,8 +670,8 @@
   }
   // always move the block
   void* ptr = os::malloc(size, memflags, stack);
-  if (PrintMalloc) {
-    tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
+  if (PrintMalloc && tty != NULL) {
+    tty->print_cr("os::realloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
   }
   // Copy to new memory if malloc didn't fail
   if ( ptr != NULL ) {