Skip to content

Commit

Permalink
src: fix alloc-dealloc-mismatch in node_snapshotable.h
Browse files Browse the repository at this point in the history
Fixes: #37442

PR-URL: #37443
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
RaisinTen authored and targos committed Feb 28, 2021
1 parent b38404e commit f1381f7
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit f1381f7

Please sign in to comment.