зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1142826 - js/src/jsapi-tests/testMutedErrors.cpp has leaks. r=luke
This commit is contained in:
Родитель
208bad3ba8
Коммит
b157ffb281
|
@ -5,6 +5,8 @@
|
|||
#include "jsfriendapi.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
using mozilla::UniquePtr;
|
||||
|
||||
static bool sErrorReportMuted = false;
|
||||
BEGIN_TEST(testMutedErrors)
|
||||
{
|
||||
|
@ -45,7 +47,7 @@ bool
|
|||
eval(const char* asciiChars, bool mutedErrors, JS::MutableHandleValue rval)
|
||||
{
|
||||
size_t len = strlen(asciiChars);
|
||||
char16_t* chars = new char16_t[len+1];
|
||||
UniquePtr<char16_t[]> chars(new char16_t[len+1]);
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
chars[i] = asciiChars[i];
|
||||
chars[len] = 0;
|
||||
|
@ -60,10 +62,7 @@ eval(const char* asciiChars, bool mutedErrors, JS::MutableHandleValue rval)
|
|||
options.setMutedErrors(mutedErrors)
|
||||
.setFileAndLine("", 0);
|
||||
|
||||
bool ok = JS::Evaluate(cx, options, chars, len, rval);
|
||||
|
||||
delete[] chars;
|
||||
return ok;
|
||||
return JS::Evaluate(cx, options, chars.get(), len, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче