From af1f41a43ee7b7bb06e43e7000101019ae24f66a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 23 Feb 2023 15:17:18 -0700 Subject: [PATCH] [wasm-api] Clear structs in _free() --- src/hb-wasm-api-blob.hh | 3 +++ src/hb-wasm-api-buffer.hh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/hb-wasm-api-blob.hh b/src/hb-wasm-api-blob.hh index e9aff8968..fbff0ff1f 100644 --- a/src/hb-wasm-api-blob.hh +++ b/src/hb-wasm-api-blob.hh @@ -40,6 +40,9 @@ blob_free (HB_WASM_EXEC_ENV return; module_free (blob->data); + + blob->data = nullref; + blob->length = 0; } diff --git a/src/hb-wasm-api-buffer.hh b/src/hb-wasm-api-buffer.hh index 949195167..07d7ab418 100644 --- a/src/hb-wasm-api-buffer.hh +++ b/src/hb-wasm-api-buffer.hh @@ -43,6 +43,10 @@ buffer_contents_free (HB_WASM_EXEC_ENV module_free (contents->info); module_free (contents->pos); + + contents->info = nullref; + contents->pos = nullref; + contents->length = 0; } void