diff --git a/src/base-object-inl.h b/src/base-object-inl.h index 480edd7463e7f0..4d5ce322f4d602 100644 --- a/src/base-object-inl.h +++ b/src/base-object-inl.h @@ -65,9 +65,8 @@ inline Environment* BaseObject::env() const { template inline void BaseObject::WeakCallback( const v8::WeakCallbackInfo& data) { - Type* self = data.GetParameter(); + std::unique_ptr self(data.GetParameter()); self->persistent().Reset(); - delete self; } diff --git a/src/env-inl.h b/src/env-inl.h index 71499946f8979d..cb4c1e8302e6af 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -349,7 +349,7 @@ inline Environment::~Environment() { #if HAVE_INSPECTOR // Destroy inspector agent before erasing the context. The inspector // destructor depends on the context still being accessible. - inspector_agent_.reset(nullptr); + inspector_agent_.reset(); #endif context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,