Fix ExplicitSymbols leak.
authorTorok Edwin <edwintorok@gmail.com>
Mon, 31 Aug 2009 16:12:29 +0000 (16:12 +0000)
committerTorok Edwin <edwintorok@gmail.com>
Mon, 31 Aug 2009 16:12:29 +0000 (16:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/DynamicLibrary.cpp

index 669422c..6efab94 100644 (file)
 // Collection of symbol name/value pairs to be searched prior to any libraries.
 static std::map<std::string, void*> *ExplicitSymbols = 0;
 
+static struct ExplicitSymbolsDeleter {
+  ~ExplicitSymbolsDeleter() {
+    if (ExplicitSymbols)
+      delete ExplicitSymbols;
+  }
+} Dummy;
+
 void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName,
                                           void *symbolValue) {
   if (ExplicitSymbols == 0)