From f1381f7a7a69a196a78db28e8b1389f5e0deb811 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Fri, 19 Feb 2021 20:39:01 +0530 Subject: [PATCH] src: fix alloc-dealloc-mismatch in node_snapshotable.h Fixes: https://github.com/nodejs/node/issues/37442 PR-URL: https://github.com/nodejs/node/pull/37443 Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- src/node_snapshotable.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_snapshotable.h b/src/node_snapshotable.h index 3a0d3e42f4c712..04277ff5378e33 100644 --- a/src/node_snapshotable.h +++ b/src/node_snapshotable.h @@ -48,7 +48,7 @@ struct InternalFieldInfo { static InternalFieldInfo* New(EmbedderObjectType type, size_t length) { InternalFieldInfo* result = - reinterpret_cast(::operator new(length)); + reinterpret_cast(::operator new[](length)); result->type = type; result->length = length; return result; @@ -56,12 +56,12 @@ struct InternalFieldInfo { InternalFieldInfo* Copy() const { InternalFieldInfo* result = - reinterpret_cast(::operator new(length)); + reinterpret_cast(::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.