Skip to content

Commit e66bf47

Browse files
committedSep 14, 2021
8273414: ResourceObj::operator delete should handle nullptr in debug builds
Reviewed-by: stuefe
1 parent 16c3ad1 commit e66bf47

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/hotspot/share/memory/allocation.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_cons
147147
}
148148

149149
void ResourceObj::operator delete(void* p) {
150+
if (p == nullptr) {
151+
return;
152+
}
150153
assert(((ResourceObj *)p)->allocated_on_C_heap(),
151154
"delete only allowed for C_HEAP objects");
152155
DEBUG_ONLY(((ResourceObj *)p)->_allocation_t[0] = (uintptr_t)badHeapOopVal;)

0 commit comments

Comments
 (0)
Please sign in to comment.