Skip to content

Commit 1c19bbd

Browse files
neethu-prasadRealCLanger
authored andcommitted
8317360: Missing null checks in JfrCheckpointManager and JfrStringPool initialization routines
Backport-of: cf4ede0e544fbd758cc9e93c695fb19fb7da0f9a
1 parent 432144b commit 1c19bbd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ bool JfrCheckpointManager::initialize() {
109109
// preallocate buffer count to each of the epoch live lists
110110
for (size_t i = 0; i < global_buffer_prealloc_count * 2; ++i) {
111111
Buffer* const buffer = mspace_allocate(global_buffer_size, _global_mspace);
112+
if (buffer == nullptr) {
113+
return false;
114+
}
112115
_global_mspace->add_to_live_list(buffer, i % 2 == 0);
113116
}
114117
assert(_global_mspace->free_list_is_empty(), "invariant");

src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ bool JfrStringPool::initialize() {
131131
// preallocate buffer count to each of the epoch live lists
132132
for (size_t i = 0; i < string_pool_cache_count * 2; ++i) {
133133
Buffer* const buffer = mspace_allocate(string_pool_buffer_size, _mspace);
134+
if (buffer == nullptr) {
135+
return false;
136+
}
134137
_mspace->add_to_live_list(buffer, i % 2 == 0);
135138
}
136139
assert(_mspace->free_list_is_empty(), "invariant");

0 commit comments

Comments
 (0)