From c97c60b900404fb387ae9d181efc285311dbc1ce Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 7 Aug 2023 11:53:21 +0900 Subject: [PATCH] binding wasm: fix a memory leak. clear the buffer memory properly when a canvas size is changed. --- src/bindings/wasm/tvgWasm.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bindings/wasm/tvgWasm.cpp b/src/bindings/wasm/tvgWasm.cpp index f390a2c4..f4498b3e 100644 --- a/src/bindings/wasm/tvgWasm.cpp +++ b/src/bindings/wasm/tvgWasm.cpp @@ -159,6 +159,7 @@ public: this->width = width; this->height = height; + free(buffer); buffer = (uint8_t*)malloc(width * height * sizeof(uint32_t)); canvas->target((uint32_t *)buffer, width, width, height, SwCanvas::ABGR8888S);