Use ScopedVector instead of dynamically allocated array.
authorantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 30 Apr 2010 10:27:25 +0000 (10:27 +0000)
committerantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 30 Apr 2010 10:27:25 +0000 (10:27 +0000)
This ensures that it'll be released on any control path leaving
the function thanks to desctuctor semantics.

BUG=42925

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4554 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/runtime.cc

index c35a1fb..0ac0641 100644 (file)
@@ -4225,7 +4225,7 @@ static Object* Runtime_GetLocalPropertyNames(Arguments args) {
   int length = LocalPrototypeChainLength(*obj);
 
   // Find the number of local properties for each of the objects.
-  int* local_property_count = NewArray<int>(length);
+  ScopedVector<int> local_property_count(length);
   int total_property_count = 0;
   Handle<JSObject> jsproto = obj;
   for (int i = 0; i < length; i++) {
@@ -4278,7 +4278,6 @@ static Object* Runtime_GetLocalPropertyNames(Arguments args) {
     }
   }
 
-  DeleteArray(local_property_count);
   return *Factory::NewJSArrayWithElements(names);
 }