From 9cf27718b68223cdc35409f8b85da1a8327be898 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Fri, 11 Oct 2013 14:59:56 +0400 Subject: [PATCH] Add info about the patch file to README and get rid of possible memory leak --- README.md | 2 ++ boost/type_index/type_index_impl.hpp | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f553fd..fc5e779 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ Runtime/Compile time copyable type info. Library is waiting for boost reiew. Documantation available at: http://apolukhin.github.com/type_index/index.html Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt). + +While ticket #9228 is not solved, use boost_test_no_rtti.patch to make the tests compile. diff --git a/boost/type_index/type_index_impl.hpp b/boost/type_index/type_index_impl.hpp index 1ed4147..77f2c9b 100644 --- a/boost/type_index/type_index_impl.hpp +++ b/boost/type_index/type_index_impl.hpp @@ -131,10 +131,18 @@ public: /// Returns user-friendly name std::string name_demangled() const { #if defined(__GNUC__) + std::string ret; int status = 0 ; char* demang = abi::__cxa_demangle(pinfo_->name(), NULL, 0, &status); BOOST_ASSERT(!status); - std::string ret(demang); + + BOOST_TRY { + ret = demang; // may throw out of memory exception + } BOOST_CATCH (...) { + free(demang); + BOOST_RETHROW; + } BOOST_CATCH_END + free(demang); return ret; #else