From b08026187ab7fbec7f8d6d4adca0a8dc9d02d74b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Feb 2023 09:34:03 -0700 Subject: [PATCH] [wasm-api] Memory house-keeping --- src/hb-wasm-api-buffer.hh | 2 ++ src/hb-wasm-api-face.hh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/hb-wasm-api-buffer.hh b/src/hb-wasm-api-buffer.hh index 8feb0ee94..20e9b484c 100644 --- a/src/hb-wasm-api-buffer.hh +++ b/src/hb-wasm-api-buffer.hh @@ -130,6 +130,8 @@ HB_WASM_API (bool_t, buffer_copy_contents) (HB_WASM_EXEC_ENV return true; } + buffer_contents_free (exec_env, contentsptr); + contents->length = length; contents->info = wasm_runtime_module_dup_data (module_inst, (const char *) buffer->info, length * sizeof (buffer->info[0])); contents->pos = wasm_runtime_module_dup_data (module_inst, (const char *) buffer->pos, length * sizeof (buffer->pos[0])); diff --git a/src/hb-wasm-api-face.hh b/src/hb-wasm-api-face.hh index ece557f46..2a458f6df 100644 --- a/src/hb-wasm-api-face.hh +++ b/src/hb-wasm-api-face.hh @@ -61,6 +61,8 @@ HB_WASM_API (bool_t, face_copy_table) (HB_WASM_EXEC_ENV return true; } + blob_free (exec_env, blobptr); + blob->length = length; blob->data = wasm_runtime_module_dup_data (module_inst, hb_data, length);