8098517: Unprotected PrintMalloc in os::realloc
Summary: Also verify tty != NULL before printing.
Reviewed-by: dholmes
--- 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 ) {