summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2017-11-25 16:47:20 +0000
committerKamil Rytarowski <n54@gmx.com>2017-11-25 16:47:20 +0000
commitc4f374ed3ab953d558b86ff0632ddf4b757f467b (patch)
treec3aa180927d0577e683d669edc290d043ccdb452 /lib
parentbe283f57de0037c7e19f0b1b75471f137efdfa1e (diff)
Plug dlerror() leak for swift_demangle
Summary: InitializeSwiftDemangler() attempts to resolve the swift_demangle symbol. If this is not available, we observe dlerror message leak. Caught on NetBSD/amd64 in TSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kubamracek, vitalybuka, dvyukov, eugenis Reviewed By: dvyukov Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40382 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
index 60f22bfd7..71d748d05 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
@@ -77,6 +77,7 @@ static swift_demangle_ft swift_demangle_f;
// symbolication.
static void InitializeSwiftDemangler() {
swift_demangle_f = (swift_demangle_ft)dlsym(RTLD_DEFAULT, "swift_demangle");
+ (void)dlerror(); // Cleanup error message in case of failure
}
// Attempts to demangle a Swift name. The demangler will return nullptr if a