1 --- a/src/hotspot/os/solaris/decoder_solaris.cpp.orig Tue Apr 14 19:31:07 2020
2 +++ b/src/hotspot/os/solaris/decoder_solaris.cpp Tue Apr 14 20:07:38 2020
8 #include "utilities/decoder_elf.hpp"
10 -#include <demangle.h>
13 bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
14 - return !cplus_demangle(symbol, buf, (size_t)buflen);
17 + size_t size = (size_t)buflen;
18 + // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
19 + // __cxa_demangle will call system "realloc" for additional memory, which
20 + // may use different malloc/realloc mechanism that allocates 'buf'.
21 + if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
22 + jio_snprintf(buf, buflen, "%s", result);
23 + // call c library's free