diff options
author | John Hodge <tpg@mutabah.net> | 2018-04-25 12:05:37 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-04-25 12:05:37 +0800 |
commit | 173dfa9fea9e65ec49fa4def9117b01c0a485ab5 (patch) | |
tree | cd525ea4e4207a0da5841da7847a18b50cad860a /src/hir/from_ast.cpp | |
parent | 4f98e4322ef7aabd3bbef8cd93c0980cd6eeeed1 (diff) | |
download | mrust-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.cpp | 3 |
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) ); } } |