Check status of __cxa_demangle

This commit is contained in:
meme 2020-08-25 13:49:12 -04:00
parent 10fd8da7d5
commit 124ba8aec7
No known key found for this signature in database
GPG key ID: 2489FE35B5D9E371

View file

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