Add info about the patch file to README and get rid of possible memory leak

This commit is contained in:
Antony Polukhin
2013-10-11 14:59:56 +04:00
parent 2b52f157ae
commit 9cf27718b6
2 changed files with 11 additions and 1 deletions

View File

@@ -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.

View File

@@ -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