diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp --- a/llvm/lib/Support/ManagedStatic.cpp +++ b/llvm/lib/Support/ManagedStatic.cpp @@ -76,8 +76,11 @@ /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm::llvm_shutdown() { - std::lock_guard Lock(*getManagedStaticMutex()); + { + std::lock_guard Lock(*getManagedStaticMutex()); - while (StaticList) - StaticList->destroy(); + while (StaticList) + StaticList->destroy(); + } + delete getManagedStaticMutex(); }