Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Unified Diff: test/common/wasm/wasm-module-runner.cc

Issue 2446593002: [wasm] Fix memory leak in wasm-module-runner.cc (Closed)
Patch Set: Add a todo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/common/wasm/wasm-module-runner.cc
diff --git a/test/common/wasm/wasm-module-runner.cc b/test/common/wasm/wasm-module-runner.cc
index 7629233ed94bb3eedc0f510e0c185c25c2a71c7f..e408210a53377c08c6f5275fb901fb370aa0f38b 100644
--- a/test/common/wasm/wasm-module-runner.cc
+++ b/test/common/wasm/wasm-module-runner.cc
@@ -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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698