Skip to content

Commit 70b623f

Browse files
neethu-prasadshipilev
authored andcommitted
8317360: Missing null checks in JfrCheckpointManager and JfrStringPool initialization routines
Backport-of: cf4ede0e544fbd758cc9e93c695fb19fb7da0f9a
1 parent 251b8e1 commit 70b623f

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
@@ -103,6 +103,9 @@ bool JfrCheckpointManager::initialize() {
103103
// preallocate buffer count to each of the epoch live lists
104104
for (size_t i = 0; i < global_buffer_prealloc_count * 2; ++i) {
105105
Buffer* const buffer = mspace_allocate(global_buffer_size, _global_mspace);
106+
if (buffer == nullptr) {
107+
return false;
108+
}
106109
_global_mspace->add_to_live_list(buffer, i % 2 == 0);
107110
}
108111
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
@@ -85,6 +85,9 @@ bool JfrStringPool::initialize() {
8585
// preallocate buffer count to each of the epoch live lists
8686
for (size_t i = 0; i < string_pool_cache_count * 2; ++i) {
8787
Buffer* const buffer = mspace_allocate(string_pool_buffer_size, _mspace);
88+
if (buffer == nullptr) {
89+
return false;
90+
}
8891
_mspace->add_to_live_list(buffer, i % 2 == 0);
8992
}
9093
assert(_mspace->free_list_is_empty(), "invariant");

0 commit comments

Comments
 (0)