[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:25:55 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 171a05fc9a355c58f9af877d03cc90dff362db39
Author: Török Edvin <edwin at clamav.net>
Date:   Wed Mar 24 16:35:40 2010 +0200

    Fix 45a45bed33fafdfae6de8380b52c80eb8c91bd2a.
    
    It didn't port SVN r99160 correctly.

diff --git a/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h b/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h
index 560e6c4..2f2fac5 100644
--- a/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h
+++ b/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h
@@ -600,8 +600,8 @@ public:
   void freeConstants() {
     for (typename MapTy::iterator I=Map.begin(), E=Map.end();
          I != E; ++I) {
-      if (I->second->use_empty())
-        delete I->second;
+      // Asserts that use_empty().
+      delete I->second;
     }
   }
     
diff --git a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.cpp b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.cpp
index 176ccf1..b4553dd 100644
--- a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.cpp
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "LLVMContextImpl.h"
+#include <algorithm>
 
 LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
   : TheTrueVal(0), TheFalseVal(0),
@@ -34,10 +35,32 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
   OpaqueTypes.insert(AlwaysOpaqueTy);
 }
 
+namespace {
+struct DropReferences {
+  // Takes the value_type of a ConstantUniqueMap's internal map, whose 'second'
+  // is a Constant*.
+  template<typename PairT>
+  void operator()(const PairT &P) {
+    P.second->dropAllReferences();
+  }
+};
+}
+
 LLVMContextImpl::~LLVMContextImpl() {
+  std::for_each(ExprConstants.map_begin(), ExprConstants.map_end(),
+                DropReferences());
+  std::for_each(ArrayConstants.map_begin(), ArrayConstants.map_end(),
+                DropReferences());
+  std::for_each(StructConstants.map_begin(), StructConstants.map_end(),
+                DropReferences());
+  std::for_each(UnionConstants.map_begin(), UnionConstants.map_end(),
+                DropReferences());
+  std::for_each(VectorConstants.map_begin(), VectorConstants.map_end(),
+                DropReferences());
   ExprConstants.freeConstants();
   ArrayConstants.freeConstants();
   StructConstants.freeConstants();
+  UnionConstants.freeConstants();
   VectorConstants.freeConstants();
   AggZeroConstants.freeConstants();
   NullPtrConstants.freeConstants();
@@ -45,13 +68,11 @@ LLVMContextImpl::~LLVMContextImpl() {
   InlineAsms.freeConstants();
   for (IntMapTy::iterator I = IntConstants.begin(), E = IntConstants.end(); 
        I != E; ++I) {
-    if (I->second->use_empty())
-      delete I->second;
+    delete I->second;
   }
   for (FPMapTy::iterator I = FPConstants.begin(), E = FPConstants.end(); 
        I != E; ++I) {
-    if (I->second->use_empty())
-      delete I->second;
+    delete I->second;
   }
   AlwaysOpaqueTy->dropRef();
   for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list