diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc index 9d5fdda61eb6d1..b732108b685af6 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc @@ -1415,8 +1415,8 @@ StartupData SerializeNodeContextInternalFields(Local holder, // To serialize the type field, save data in a EmbedderTypeInfo. if (index == BaseObject::kEmbedderType) { int size = sizeof(EmbedderTypeInfo); - char* data = new char[size]; - memset(data, 0, size); // Make the padding reproducible. + // Zero-initialize to make the padding reproducible. + char* data = new char[size](); // We need to use placement new because V8 calls delete[] on the returned // data. // TODO(joyeecheung): support cppgc objects.