diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-03 03:30:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 03:30:31 +0200 |
commit | 5effd0d06cceb25c75a561b505a4e6a23ce0bab2 (patch) | |
tree | 615100fa26eb3beafce6516342dedc46f6d53091 /src | |
parent | 7c1253ee4513ec86e851536e29fd5f11d13b0b19 (diff) | |
download | binaryen-5effd0d06cceb25c75a561b505a4e6a23ce0bab2.tar.gz binaryen-5effd0d06cceb25c75a561b505a4e6a23ce0bab2.tar.bz2 binaryen-5effd0d06cceb25c75a561b505a4e6a23ce0bab2.zip |
Fix Wasm2JSBuilder leaking temporary Function (#3098)
Fixes `Wasm2JSBuilder` leaking a temporary `Function` (`WASM_FETCH_HIGH_BITS`) in `Wasm2JSBuilder::processWasm`. The function is created to be converted to JS, but is not actually part of the module, so it either needs to be cleaned up separately or be added to the module. This PR does the latter in case it is useful.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm2js.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index c06d90180..ab093dd03 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -424,13 +424,14 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { }); if (generateFetchHighBits) { Builder builder(allocator); - asmFunc[3]->push_back(processFunction( - wasm, - builder.makeFunction(WASM_FETCH_HIGH_BITS, - Signature(Type::none, Type::i32), - {}, - builder.makeReturn(builder.makeGlobalGet( - INT64_TO_32_HIGH_BITS, Type::i32))))); + asmFunc[3]->push_back( + processFunction(wasm, + wasm->addFunction(builder.makeFunction( + WASM_FETCH_HIGH_BITS, + Signature(Type::none, Type::i32), + {}, + builder.makeReturn(builder.makeGlobalGet( + INT64_TO_32_HIGH_BITS, Type::i32)))))); auto e = new Export(); e->name = WASM_FETCH_HIGH_BITS; e->value = WASM_FETCH_HIGH_BITS; |