summaryrefslogtreecommitdiff
path: root/src/wasm-shell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-shell.cpp')
-rw-r--r--src/wasm-shell.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp
index 8577b827e..26ce56e8e 100644
--- a/src/wasm-shell.cpp
+++ b/src/wasm-shell.cpp
@@ -28,7 +28,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
ShellExternalInterface() : memory(nullptr) {}
void init(Module& wasm) override {
- memory = new char[wasm.memory.initial];
+ memory = (char*)malloc(wasm.memory.initial);
// apply memory segments
for (auto segment : wasm.memory.segments) {
memcpy(memory + segment.offset, segment.data, segment.size);
@@ -103,8 +103,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
}
void growMemory(size_t oldSize, size_t newSize) override {
- delete memory;
- memory = new char[newSize];
+ memory = (char*)realloc(memory, newSize);
}
jmp_buf trapState;