binding wasm: fix a memory leak.

clear the buffer memory properly when a canvas size is changed.
This commit is contained in:
Hermet Park 2023-08-07 11:53:21 +09:00 committed by Hermet Park
parent da1b036e4f
commit c97c60b900

View file

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