diff options
author | 2023-07-30 02:03:32 -0700 | |
---|---|---|
committer | 2023-07-30 02:03:32 -0700 | |
commit | 1db119ec1180fbbfb5fa55d46f3b38ea19738bc2 (patch) | |
tree | 64eb6f456d47c287856bfdf7bf2d50c1ea2237b7 /src/bun.js/bindings/napi.cpp | |
parent | 413fd281208f24a532c47249dec1bfc3aef2bf37 (diff) | |
download | bun-1db119ec1180fbbfb5fa55d46f3b38ea19738bc2.tar.gz bun-1db119ec1180fbbfb5fa55d46f3b38ea19738bc2.tar.zst bun-1db119ec1180fbbfb5fa55d46f3b38ea19738bc2.zip |
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>
Diffstat (limited to 'src/bun.js/bindings/napi.cpp')
-rw-r--r-- | src/bun.js/bindings/napi.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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, |