Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: fix alloc-dealloc-mismatch in node_snapshotable.h
Fixes: #37442
  • Loading branch information
RaisinTen committed Feb 20, 2021
commit 3789d143fcd98813357e9b0e617236ed7ddd2468
6 changes: 3 additions & 3 deletions src/node_snapshotable.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ struct InternalFieldInfo {

static InternalFieldInfo* New(EmbedderObjectType type, size_t length) {
InternalFieldInfo* result =
reinterpret_cast<InternalFieldInfo*>(::operator new(length));
reinterpret_cast<InternalFieldInfo*>(::operator new[](length));
result->type = type;
result->length = length;
return result;
}

InternalFieldInfo* Copy() const {
InternalFieldInfo* result =
reinterpret_cast<InternalFieldInfo*>(::operator new(length));
reinterpret_cast<InternalFieldInfo*>(::operator new[](length));
memcpy(result, this, length);
return result;
}

void Delete() { ::operator delete(this); }
void Delete() { ::operator delete[](this); }
};

// An interface for snapshotable native objects to inherit from.
Expand Down