[wasm-api] Memory house-keeping

This commit is contained in:
Behdad Esfahbod 2023-02-25 09:34:03 -07:00
parent f2d227ad9f
commit b08026187a
2 changed files with 4 additions and 0 deletions

View File

@ -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]));

View File

@ -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);