Use ScopedVector instead of dynamically allocated array.

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
This commit is contained in:
antonm@chromium.org 2010-04-30 10:27:25 +00:00
parent e7a3875bb4
commit 8e56358e1d

View 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);
}