summaryrefslogtreecommitdiff
path: root/src/wasm-traversal.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-27 19:25:15 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-27 19:25:15 -0700
commit6a6bdc1cef5ec35cb9f7caf6e10ec76ee1107d0d (patch)
tree9ed1b23b55c86f8fa1aee285bfdde9d47c2f1ae8 /src/wasm-traversal.h
parent4a85f62e8a83117a081e9691d8830b6a7a876d1d (diff)
parentf0a4f15dc27ffff9505503a8168854b7662b2657 (diff)
downloadbinaryen-6a6bdc1cef5ec35cb9f7caf6e10ec76ee1107d0d.tar.gz
binaryen-6a6bdc1cef5ec35cb9f7caf6e10ec76ee1107d0d.tar.bz2
binaryen-6a6bdc1cef5ec35cb9f7caf6e10ec76ee1107d0d.zip
Merge pull request #403 from WebAssembly/leaks
Fix leaks and enable leak checks
Diffstat (limited to 'src/wasm-traversal.h')
-rw-r--r--src/wasm-traversal.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h
index a2e29ea77..59fea2a56 100644
--- a/src/wasm-traversal.h
+++ b/src/wasm-traversal.h
@@ -181,14 +181,14 @@ struct Walker : public VisitorType {
// Dispatch statically through the SubType.
SubType* self = static_cast<SubType*>(this);
- for (auto curr : module->functionTypes) {
- self->visitFunctionType(curr);
+ for (auto& curr : module->functionTypes) {
+ self->visitFunctionType(curr.get());
}
- for (auto curr : module->imports) {
- self->visitImport(curr);
+ for (auto& curr : module->imports) {
+ self->visitImport(curr.get());
}
- for (auto curr : module->exports) {
- self->visitExport(curr);
+ for (auto& curr : module->exports) {
+ self->visitExport(curr.get());
}
auto processFunction = [](SubType* instance, Function* func) {
@@ -201,8 +201,8 @@ struct Walker : public VisitorType {
// if this is not a function-parallel traversal, run
// sequentially
if (!self->isFunctionParallel()) {
- for (auto curr : module->functions) {
- processFunction(self, curr);
+ for (auto& curr : module->functions) {
+ processFunction(self, curr.get());
}
} else {
// execute in parallel on helper threads
@@ -222,7 +222,7 @@ struct Walker : public VisitorType {
if (index >= numFunctions) {
return ThreadWorkState::Finished; // nothing left
}
- Function* curr = module->functions[index];
+ Function* curr = module->functions[index].get();
// do the current task
processFunction(instance, curr);
if (index + 1 == numFunctions) {