8273414: ResourceObj::operator delete should handle nullptr in debug builds

Reviewed-by: stuefe
This commit is contained in:
Leo Korinth 2021-09-14 21:17:59 +00:00
parent 16c3ad1ff4
commit e66bf47248

View File

@ -147,6 +147,9 @@ void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_cons
}
void ResourceObj::operator delete(void* p) {
if (p == nullptr) {
return;
}
assert(((ResourceObj *)p)->allocated_on_C_heap(),
"delete only allowed for C_HEAP objects");
DEBUG_ONLY(((ResourceObj *)p)->_allocation_t[0] = (uintptr_t)badHeapOopVal;)