Commit 9149e4c8 authored by olehougaard's avatar olehougaard

Fixed some memory leaks in unit tests.

Review URL: http://codereview.chromium.org/46103

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1516 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6a9d16f4
...@@ -117,6 +117,7 @@ class ApiTestFuzzer: public v8::internal::Thread { ...@@ -117,6 +117,7 @@ class ApiTestFuzzer: public v8::internal::Thread {
gate_(v8::internal::OS::CreateSemaphore(0)), gate_(v8::internal::OS::CreateSemaphore(0)),
active_(true) { active_(true) {
} }
~ApiTestFuzzer() { delete gate_; }
// The ApiTestFuzzer is also a Thread, so it has a Run method. // The ApiTestFuzzer is also a Thread, so it has a Run method.
virtual void Run(); virtual void Run();
...@@ -5566,14 +5567,14 @@ THREADED_TEST(AccessChecksReenabledCorrectly) { ...@@ -5566,14 +5567,14 @@ THREADED_TEST(AccessChecksReenabledCorrectly) {
// Add more than 8 (see kMaxFastProperties) properties // Add more than 8 (see kMaxFastProperties) properties
// so that the constructor will force copying map. // so that the constructor will force copying map.
// Cannot sprintf, gcc complains unsafety. // Cannot sprintf, gcc complains unsafety.
char buf[5]; char buf[4];
for (char i = '0'; i <= '9' ; i++) { for (char i = '0'; i <= '9' ; i++) {
buf[1] = i; buf[0] = i;
for (char j = '0'; j <= '9'; j++) { for (char j = '0'; j <= '9'; j++) {
buf[2] = j; buf[1] = j;
for (char k = '0'; k <= '9'; k++) { for (char k = '0'; k <= '9'; k++) {
buf[3] = k; buf[2] = k;
buf[4] = 0; buf[3] = 0;
templ->Set(v8_str(buf), v8::Number::New(k)); templ->Set(v8_str(buf), v8::Number::New(k));
} }
} }
...@@ -5621,6 +5622,7 @@ TEST(PreCompile) { ...@@ -5621,6 +5622,7 @@ TEST(PreCompile) {
v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script)); v8::ScriptData *sd = v8::ScriptData::PreCompile(script, strlen(script));
CHECK_NE(sd->Length(), 0); CHECK_NE(sd->Length(), 0);
CHECK_NE(sd->Data(), NULL); CHECK_NE(sd->Data(), NULL);
delete sd;
} }
...@@ -5702,6 +5704,8 @@ class RegExpInterruptTest { ...@@ -5702,6 +5704,8 @@ class RegExpInterruptTest {
CHECK(regexp_success_); CHECK(regexp_success_);
CHECK(gc_success_); CHECK(gc_success_);
} }
RegExpInterruptTest() : block_(NULL) {}
~RegExpInterruptTest() { delete block_; }
private: private:
// Number of garbage collections required. // Number of garbage collections required.
static const int kRequiredGCs = 5; static const int kRequiredGCs = 5;
......
...@@ -53,6 +53,7 @@ TEST(List) { ...@@ -53,6 +53,7 @@ TEST(List) {
list->Clear(); list->Clear();
CHECK_EQ(0, list->length()); CHECK_EQ(0, list->length());
delete list;
} }
......
...@@ -117,6 +117,7 @@ static void InitializeBuildingBlocks( ...@@ -117,6 +117,7 @@ static void InitializeBuildingBlocks(
StringShape shape(*building_blocks[i]); StringShape shape(*building_blocks[i]);
CHECK_EQ(buf[j], building_blocks[i]->Get(shape, j)); CHECK_EQ(buf[j], building_blocks[i]->Get(shape, j));
} }
DeleteArray<char>(buf);
break; break;
} }
} }
...@@ -364,6 +365,7 @@ TEST(DeepAscii) { ...@@ -364,6 +365,7 @@ TEST(DeepAscii) {
for (int i = 0; i < 500; i++) { for (int i = 0; i < 500; i++) {
TraverseFirst(flat_string, string, DEEP_ASCII_DEPTH); TraverseFirst(flat_string, string, DEEP_ASCII_DEPTH);
} }
DeleteArray<char>(foo);
} }
......
...@@ -174,5 +174,6 @@ TEST(SNPrintF) { ...@@ -174,5 +174,6 @@ TEST(SNPrintF) {
} else { } else {
CHECK_EQ(length, strlen(buffer.start())); CHECK_EQ(length, strlen(buffer.start()));
} }
buffer.Dispose();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment