diff --git a/src/Util/logger.cpp b/src/Util/logger.cpp index b8a43878a..2ae000036 100644 --- a/src/Util/logger.cpp +++ b/src/Util/logger.cpp @@ -624,7 +624,7 @@ void LoggerWrapper::printLogV(Logger &logger, int level, const char *file, const char *str = nullptr; if (vasprintf(&str, fmt, ap) > 0 && str) { info << str; - free(str); + delete [] str; // 开启asan后,用free会卡死 } } diff --git a/src/Util/util.cpp b/src/Util/util.cpp index 6f2327b5d..b4ee662fc 100644 --- a/src/Util/util.cpp +++ b/src/Util/util.cpp @@ -623,7 +623,7 @@ string demangle(const char *mangled) { string out; if (status == 0 && demangled) { // Demangling succeeeded. out.append(demangled); - free(demangled); + delete [] demangled; // 开启asan后,用free会卡死 } else { out.append(mangled); }