File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -255,24 +255,21 @@ void ContextifyContext::MakeContext(const FunctionCallbackInfo<Value>& args) {
255255 options.allow_code_gen_wasm = args[4 ].As <Boolean>();
256256
257257 TryCatchScope try_catch (env);
258- ContextifyContext* context = new ContextifyContext (env, sandbox, options);
258+ auto context_ptr = std::make_unique< ContextifyContext> (env, sandbox, options);
259259
260260 if (try_catch.HasCaught ()) {
261261 if (!try_catch.HasTerminated ())
262262 try_catch.ReThrow ();
263- delete context;
264263 return ;
265264 }
266265
267- if (context->context ().IsEmpty ()) {
268- delete context;
266+ if (context_ptr->context ().IsEmpty ())
269267 return ;
270- }
271268
272269 sandbox->SetPrivate (
273270 env->context (),
274271 env->contextify_context_private_symbol (),
275- External::New (env->isolate (), context ));
272+ External::New (env->isolate (), context_ptr. release () ));
276273}
277274
278275
You can’t perform that action at this time.
0 commit comments