| Index: test/cctest/test-serialize.cc
|
| diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
|
| index 06cf8368822d8a21b4f539792cca5b5a4f4b8e1c..a5cd0337117d6ebd1ea68f74029e58125bc92968 100644
|
| --- a/test/cctest/test-serialize.cc
|
| +++ b/test/cctest/test-serialize.cc
|
| @@ -2172,11 +2172,14 @@ v8::StartupData SerializeInternalFields(v8::Local<v8::Object> holder,
|
| return {payload, size};
|
| }
|
|
|
| +std::vector<InternalFieldData*> deserialized_data;
|
| +
|
| void DeserializeInternalFields(v8::Local<v8::Object> holder, int index,
|
| v8::StartupData payload) {
|
| InternalFieldData* data = new InternalFieldData{0};
|
| memcpy(data, payload.data, payload.raw_size);
|
| holder->SetAlignedPointerInInternalField(index, data);
|
| + deserialized_data.push_back(data);
|
| }
|
|
|
| TEST(SnapshotCreatorTemplates) {
|
| @@ -2314,9 +2317,8 @@ TEST(SnapshotCreatorTemplates) {
|
| CHECK(v8::FunctionTemplate::FromSnapshot(isolate, 2).IsEmpty());
|
| CHECK(v8::Context::FromSnapshot(isolate, 1).IsEmpty());
|
|
|
| - delete a1;
|
| - delete b0;
|
| - delete c0;
|
| + for (auto data : deserialized_data) delete data;
|
| + deserialized_data.clear();
|
| }
|
|
|
| {
|
| @@ -2334,6 +2336,9 @@ TEST(SnapshotCreatorTemplates) {
|
| v8::Context::Scope context_scope(context);
|
| ExpectInt32("g()", 1337);
|
| ExpectInt32("f()", 42);
|
| +
|
| + for (auto data : deserialized_data) delete data;
|
| + deserialized_data.clear();
|
| }
|
| }
|
| isolate->Dispose();
|
|
|