Skip to content

Commit f1381f7

Browse files
RaisinTentargos
authored andcommitted
src: fix alloc-dealloc-mismatch in node_snapshotable.h
Fixes: #37442 PR-URL: #37443 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent b38404e commit f1381f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/node_snapshotable.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ struct InternalFieldInfo {
4848

4949
static InternalFieldInfo* New(EmbedderObjectType type, size_t length) {
5050
InternalFieldInfo* result =
51-
reinterpret_cast<InternalFieldInfo*>(::operator new(length));
51+
reinterpret_cast<InternalFieldInfo*>(::operator new[](length));
5252
result->type = type;
5353
result->length = length;
5454
return result;
5555
}
5656

5757
InternalFieldInfo* Copy() const {
5858
InternalFieldInfo* result =
59-
reinterpret_cast<InternalFieldInfo*>(::operator new(length));
59+
reinterpret_cast<InternalFieldInfo*>(::operator new[](length));
6060
memcpy(result, this, length);
6161
return result;
6262
}
6363

64-
void Delete() { ::operator delete(this); }
64+
void Delete() { ::operator delete[](this); }
6565
};
6666

6767
// An interface for snapshotable native objects to inherit from.

0 commit comments

Comments
 (0)