From b1431f7b2bf40d082fd784f7242233cb3f54e106 Mon Sep 17 00:00:00 2001 From: Gerrit Niezen Date: Tue, 7 Feb 2023 15:15:13 +0000 Subject: [PATCH] Copy data into V8 memory cage instead --- binding.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/binding.c b/binding.c index 8aec69d..dc94902 100644 --- a/binding.c +++ b/binding.c @@ -592,7 +592,8 @@ static napi_value get_aligned_buffer(napi_env env, napi_callback_info info) { assert(((uintptr_t)(const void *)(ptr) & (alignment - 1)) == 0); memset(ptr, 0, size); napi_value buffer; - OK(napi_create_external_buffer(env, size, ptr, free_aligned, NULL, &buffer)); + void* copied_data = NULL; + OK(napi_create_buffer_copy(env, size, ptr, &copied_data, &buffer)); return buffer; }