Commit 1fe7a917 authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Fix memory leak in wasm-module-runner.cc

BUG=chromium:658057
R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2446593002
Cr-Commit-Position: refs/heads/master@{#40586}
parent 8d5acea9
......@@ -61,6 +61,7 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
// Although we decoded the module for some pre-validation, run the bytes
// again through the normal pipeline.
// TODO(wasm): Use {module} instead of decoding the module bytes again.
MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes(
isolate, module->module_start, module->module_end, thrower,
ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr);
......@@ -81,14 +82,14 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
const Handle<JSObject> CompileInstantiateWasmModuleForTesting(
Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
const byte* module_end, ModuleOrigin origin) {
const WasmModule* module = DecodeWasmModuleForTesting(
isolate, thrower, module_start, module_end, origin);
std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting(
isolate, thrower, module_start, module_end, origin));
if (module == nullptr) {
thrower->CompileError("Wasm module decoding failed");
return Handle<JSObject>::null();
}
return InstantiateModuleForTesting(isolate, thrower, module);
return InstantiateModuleForTesting(isolate, thrower, module.get());
}
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment