diff --git a/VTIL-Common/io/formatting.hpp b/VTIL-Common/io/formatting.hpp index e598658..0e34996 100644 --- a/VTIL-Common/io/formatting.hpp +++ b/VTIL-Common/io/formatting.hpp @@ -83,7 +83,14 @@ namespace vtil::format #ifdef __GNUG__ int status; char* demangled_name = abi::__cxa_demangle( in.data(), nullptr, nullptr, &status ); - in = demangled_name; + // If demangling succeeds, set the name. + // + if ( status == 0 ) + { + in = demangled_name; + } + // Free unconditionally. + // free( demangled_name ); #endif @@ -352,4 +359,4 @@ namespace vtil using format::CustomStringConvertible; using format::StdStringConvertible; using format::StringConvertible; -}; \ No newline at end of file +};