summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-04-25 12:05:37 +0800
committerJohn Hodge <tpg@mutabah.net>2018-04-25 12:05:37 +0800
commit173dfa9fea9e65ec49fa4def9117b01c0a485ab5 (patch)
treecd525ea4e4207a0da5841da7847a18b50cad860a /src/hir/from_ast.cpp
parent4f98e4322ef7aabd3bbef8cd93c0980cd6eeeed1 (diff)
downloadmrust-173dfa9fea9e65ec49fa4def9117b01c0a485ab5.tar.gz
Fix #72 - Use-after-free of a string in HIR lowering
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 99408020..ce9b2490 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -1290,7 +1290,8 @@ void _add_mod_val_item(::HIR::Module& mod, ::std::string name, bool is_pub, ::H
auto& submod = *submod_ptr;
::std::string name = FMT("#" << i);
auto item_path = ::HIR::ItemPath(path, name.c_str());
- _add_mod_ns_item( mod, mv$(name), false, ::HIR::TypeItem::make_Module( LowerHIR_Module(submod, item_path, mod.m_traits) ) );
+ auto ti = ::HIR::TypeItem::make_Module( LowerHIR_Module(submod, item_path, mod.m_traits) );
+ _add_mod_ns_item( mod, mv$(name), false, mv$(ti) );
}
}