diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/solaris/dump_symbols.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/solaris/dump_symbols.cc b/src/common/solaris/dump_symbols.cc index a0697ff9..816d744c 100644 --- a/src/common/solaris/dump_symbols.cc +++ b/src/common/solaris/dump_symbols.cc @@ -176,7 +176,9 @@ inline void RecalculateOffset(struct slist* cur_list, char *stabstr) { // Demangle using demangle library on Solaris. std::string Demangle(const char *mangled) { int status = 0; + std::string str(mangled); char *demangled = (char *)malloc(demangleLen); + if (!demangled) { fprintf(stderr, "no enough memory.\n"); goto out; @@ -188,12 +190,11 @@ std::string Demangle(const char *mangled) { goto out; } - std::string str(demangled); + str = demangled; free(demangled); - return str; out: - return std::string(mangled); + return str; } bool WriteFormat(int fd, const char *fmt, ...) { |