Skip to content

Commit 62f39bd

Browse files
committed
8350636: Potential null-pointer dereference in MallocSiteTable::new_entry
Reviewed-by: dholmes
1 parent cfeb7d6 commit 62f39bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hotspot/share/nmt/mallocSiteTable.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ MallocSite* MallocSiteTable::malloc_site(uint32_t marker) {
179179
MallocSiteHashtableEntry* MallocSiteTable::new_entry(const NativeCallStack& key, MemTag mem_tag) {
180180
void* p = AllocateHeap(sizeof(MallocSiteHashtableEntry), mtNMT,
181181
*hash_entry_allocation_stack(), AllocFailStrategy::RETURN_NULL);
182-
return ::new (p) MallocSiteHashtableEntry(key, mem_tag);
182+
if (p == nullptr) {
183+
return nullptr;
184+
} else {
185+
return ::new (p) MallocSiteHashtableEntry(key, mem_tag);
186+
}
183187
}
184188

185189
bool MallocSiteTable::walk_malloc_site(MallocSiteWalker* walker) {

0 commit comments

Comments
 (0)