From 1db119ec1180fbbfb5fa55d46f3b38ea19738bc2 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 30 Jul 2023 02:03:32 -0700 Subject: Fix memory leak (#3887) * Fix memory leak * Remove an extra copy * Further fixes --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/bindings/napi.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/bun.js/bindings/napi.cpp') diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index 6e47db8c4..c27bcf533 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -170,6 +170,8 @@ typedef struct StackAllocatedCallFrame { extern "C" Zig::GlobalObject* Bun__getDefaultGlobal(); +WTF_MAKE_ISO_ALLOCATED_IMPL(NapiRef); + static uint32_t getPropertyAttributes(napi_property_attributes attributes) { uint32_t result = 0; @@ -951,7 +953,7 @@ extern "C" napi_status napi_delete_reference(napi_env env, napi_ref ref) extern "C" void napi_delete_reference_internal(napi_ref ref) { NapiRef* napiRef = toJS(ref); - napiRef->~NapiRef(); + delete napiRef; } extern "C" napi_status napi_is_detached_arraybuffer(napi_env env, -- cgit v1.2.3