diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp index ea47e435c0b..b25e07bc36d 100644 --- a/src/hotspot/share/asm/codeBuffer.cpp +++ b/src/hotspot/share/asm/codeBuffer.cpp @@ -135,10 +135,11 @@ CodeBuffer::~CodeBuffer() { // Previous incarnations of this buffer are held live, so that internal // addresses constructed before expansions will not be confused. cb->free_blob(); - // free any overflow storage - delete cb->_overflow_arena; } - + if (_overflow_arena != nullptr) { + // free any overflow storage + delete _overflow_arena; + } if (_shared_trampoline_requests != nullptr) { delete _shared_trampoline_requests; } @@ -973,8 +974,6 @@ void CodeBuffer::take_over_code_from(CodeBuffer* cb) { CodeSection* this_sect = code_section(n); this_sect->take_over_code_from(cb_sect); } - _overflow_arena = cb->_overflow_arena; - cb->_overflow_arena = nullptr; // Make sure the old cb won't try to use it or free it. DEBUG_ONLY(cb->_blob = (BufferBlob*)badAddress); }