Revision: 15490
Author:   [email protected]
Date:     Thu Jul  4 08:57:43 2013
Log:      Plug some memory leaks in parser tests.

BUG=v8:2763
[email protected]

Review URL: https://codereview.chromium.org/18694004

Patch from Sergey Matveev <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15490

Modified:
 /branches/bleeding_edge/test/cctest/test-parsing.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-parsing.cc Thu Jun 6 07:38:26 2013 +++ /branches/bleeding_edge/test/cctest/test-parsing.cc Thu Jul 4 08:57:43 2013
@@ -1048,8 +1048,9 @@
 i::Handle<i::String> FormatMessage(i::ScriptDataImpl* data) {
   i::Isolate* isolate = i::Isolate::Current();
   i::Factory* factory = isolate->factory();
+  const char* message = data->BuildMessage();
   i::Handle<i::String> format = v8::Utils::OpenHandle(
- *v8::String::New(data->BuildMessage()));
+                                    *v8::String::New(message));
   i::Vector<const char*> args = data->BuildArgs();
   i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length());
   for (int i = 0; i < args.length(); i++) {
@@ -1068,6 +1069,11 @@
i::Execution::Call(format_fun, builtins, 2, arg_handles, &has_exception);
   CHECK(!has_exception);
   CHECK(result->IsString());
+  for (int i = 0; i < args.length(); i++) {
+    i::DeleteArray(args[i]);
+  }
+  i::DeleteArray(args.start());
+  i::DeleteArray(message);
   return i::Handle<i::String>::cast(result);
 }

@@ -1279,7 +1285,7 @@
             + kSuffixLen + i::StrLength("label: for (;;) {  }");

         // Plug the source code pieces together.
-        i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
+        i::ScopedVector<char> program(kProgramSize + 1);
         int length = i::OS::SNPrintF(program,
             "label: for (;;) { %s%s%s%s }",
             context_data[i][0],

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to