Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: test/cctest/test-serialize.cc

Issue 2582333002: [serializer] fix leak in test. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698