From 619d0c182f43e2a4a7bae6932c9316e9625ac688 Mon Sep 17 00:00:00 2001 From: Dongjin Na Date: Tue, 16 Oct 2018 21:50:28 +0900 Subject: [PATCH] test: create test objects in the stack instead of the heap --- test/basic_types/boolean.cc | 4 ++-- test/basic_types/number.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/basic_types/boolean.cc b/test/basic_types/boolean.cc index 900438f62..fd6e3165f 100644 --- a/test/basic_types/boolean.cc +++ b/test/basic_types/boolean.cc @@ -12,8 +12,8 @@ Value CreateEmptyBoolean(const CallbackInfo& info) { } Value CreateBooleanFromExistingValue(const CallbackInfo& info) { - Boolean* boolean = new Boolean(info.Env(), info[0].As()); - return Boolean::New(info.Env(), boolean->Value()); + Boolean boolean(info.Env(), info[0].As()); + return Boolean::New(info.Env(), boolean.Value()); } Value CreateBooleanFromPrimitive(const CallbackInfo& info) { diff --git a/test/basic_types/number.cc b/test/basic_types/number.cc index 436d51918..4ccb844b5 100644 --- a/test/basic_types/number.cc +++ b/test/basic_types/number.cc @@ -67,8 +67,8 @@ Value OperatorDouble(const CallbackInfo& info) { } Value CreateEmptyNumber(const CallbackInfo& info) { - Number* number = new Number(); - return Boolean::New(info.Env(), number->IsEmpty()); + Number number; + return Boolean::New(info.Env(), number.IsEmpty()); } Value CreateNumberFromExistingValue(const CallbackInfo& info) {