From 173dfa9fea9e65ec49fa4def9117b01c0a485ab5 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 25 Apr 2018 12:05:37 +0800 Subject: Fix #72 - Use-after-free of a string in HIR lowering --- src/hir/from_ast.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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) ); } } -- cgit v1.2.3