From 71fddd30ba03374fde7d740085f10a17be17f106 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 7 Aug 2012 23:41:40 +0200 Subject: don't crash if demangling fails, fdo#52539 --- src/cppunit/TypeInfoHelper.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index ff1d662..8c97178 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -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 -- cgit v1.2.1 From ee31b6a137195aa55cb98b0b8e65c587487ea0db Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 7 Aug 2012 23:59:57 +0200 Subject: use portable way to access free, fdo#52536 --- src/cppunit/TypeInfoHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index 8c97178..2df5786 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -6,7 +6,7 @@ #include #if CPPUNIT_HAVE_GCC_ABI_DEMANGLE -#include +#include #include #endif -- cgit v1.2.1 From ec8f67b0bf103b553f435d3b969965f9cff58768 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 8 Aug 2012 00:30:01 +0200 Subject: also adapt the configure check to portable header for free --- config/ax_cxx_gcc_abi_demangle.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ax_cxx_gcc_abi_demangle.m4 b/config/ax_cxx_gcc_abi_demangle.m4 index dd3c439..0927d8c 100644 --- a/config/ax_cxx_gcc_abi_demangle.m4 +++ b/config/ax_cxx_gcc_abi_demangle.m4 @@ -15,7 +15,7 @@ ac_cv_cxx_gcc_abi_demangle, AC_LANG_CPLUSPLUS AC_TRY_COMPILE([#include #include -#include +#include #include template -- cgit v1.2.1