[PATCH] D83372: Fix for memory leak reported by Valgrind
Maksym Wezdecki via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 01:04:58 PDT 2020
mwezdeck updated this revision to Diff 276941.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83372/new/
https://reviews.llvm.org/D83372
Files:
llvm/lib/Support/ManagedStatic.cpp
Index: llvm/lib/Support/ManagedStatic.cpp
===================================================================
--- llvm/lib/Support/ManagedStatic.cpp
+++ llvm/lib/Support/ManagedStatic.cpp
@@ -76,8 +76,11 @@
/// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
void llvm::llvm_shutdown() {
- std::lock_guard<std::recursive_mutex> Lock(*getManagedStaticMutex());
+ {
+ std::lock_guard<std::recursive_mutex> Lock(*getManagedStaticMutex());
- while (StaticList)
- StaticList->destroy();
+ while (StaticList)
+ StaticList->destroy();
+ }
+ delete getManagedStaticMutex();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83372.276941.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200710/831d2390/attachment.bin>
More information about the llvm-commits
mailing list