Skip to content

Commit e99dc36

Browse files
committed
fixup! src: zero-initialize data that are copied into the snapshot
1 parent af91d7d commit e99dc36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node_snapshotable.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ StartupData SerializeNodeContextInternalFields(Local<Object> holder,
14151415
// To serialize the type field, save data in a EmbedderTypeInfo.
14161416
if (index == BaseObject::kEmbedderType) {
14171417
int size = sizeof(EmbedderTypeInfo);
1418-
char* data = new char[size];
1419-
memset(data, 0, size); // Make the padding reproducible.
1418+
// Zero-initialize to make the padding reproducible.
1419+
char* data = new char[size]();
14201420
// We need to use placement new because V8 calls delete[] on the returned
14211421
// data.
14221422
// TODO(joyeecheung): support cppgc objects.

0 commit comments

Comments
 (0)