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, ...@@ -61,6 +61,7 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
// Although we decoded the module for some pre-validation, run the bytes // Although we decoded the module for some pre-validation, run the bytes
// again through the normal pipeline. // again through the normal pipeline.
// TODO(wasm): Use {module} instead of decoding the module bytes again.
MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes(
isolate, module->module_start, module->module_end, thrower, isolate, module->module_start, module->module_end, thrower,
ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr); ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr);
...@@ -81,14 +82,14 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, ...@@ -81,14 +82,14 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
const Handle<JSObject> CompileInstantiateWasmModuleForTesting( const Handle<JSObject> CompileInstantiateWasmModuleForTesting(
Isolate* isolate, ErrorThrower* thrower, const byte* module_start, Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
const byte* module_end, ModuleOrigin origin) { const byte* module_end, ModuleOrigin origin) {
const WasmModule* module = DecodeWasmModuleForTesting( std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting(
isolate, thrower, module_start, module_end, origin); isolate, thrower, module_start, module_end, origin));
if (module == nullptr) { if (module == nullptr) {
thrower->CompileError("Wasm module decoding failed"); thrower->CompileError("Wasm module decoding failed");
return Handle<JSObject>::null(); return Handle<JSObject>::null();
} }
return InstantiateModuleForTesting(isolate, thrower, module); return InstantiateModuleForTesting(isolate, thrower, module.get());
} }
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, 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