diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cppunit/TypeInfoHelper.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index ff1d662..2df5786 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -6,7 +6,7 @@ #include <string> #if CPPUNIT_HAVE_GCC_ABI_DEMANGLE -#include <malloc.h> +#include <cstdlib> #include <cxxabi.h> #endif @@ -24,8 +24,16 @@ TypeInfoHelper::getClassName( const std::type_info &info ) c_name = abi::__cxa_demangle( info.name(), 0, 0, &status ); - std::string name( c_name ); - free( c_name ); + std::string name; + if(c_name) + { + name = std::string( c_name ); + free( c_name ); + } + else + { + name = std::string( info.name() ); + } #else // CPPUNIT_HAVE_GCC_ABI_DEMANGLE |