Commit 05f56d94 authored by Maciej Goszczycki's avatar Maciej Goszczycki Committed by Commit Bot

[heap] Set code_object_registry_ to nullptr after deleting it

Prevents potential double free if
ReleaseAllocatedMemoryNeededForWritableChunk were to be called twice.

Change-Id: I97f0b3e6a279297faa37d541b81f465fec68b894
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1667414Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Maciej Goszczycki <goszczycki@google.com>
Cr-Commit-Position: refs/heads/master@{#62290}
parent bc532e5f
......@@ -1376,6 +1376,10 @@ void MemoryChunk::ReleaseAllocatedMemoryNeededForWritableChunk() {
delete page_protection_change_mutex_;
page_protection_change_mutex_ = nullptr;
}
if (code_object_registry_ != nullptr) {
delete code_object_registry_;
code_object_registry_ = nullptr;
}
ReleaseSlotSet<OLD_TO_NEW>();
ReleaseSlotSet<OLD_TO_OLD>();
......@@ -1385,7 +1389,6 @@ void MemoryChunk::ReleaseAllocatedMemoryNeededForWritableChunk() {
if (local_tracker_ != nullptr) ReleaseLocalTracker();
if (young_generation_bitmap_ != nullptr) ReleaseYoungGenerationBitmap();
if (code_object_registry_ != nullptr) delete code_object_registry_;
}
void MemoryChunk::ReleaseAllAllocatedMemory() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment