Really fix the leak in the attributes list. Thanks to Benjamin Kramer for pointing...
authorOwen Anderson <resistor@mac.com>
Tue, 9 Nov 2010 17:46:38 +0000 (17:46 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 9 Nov 2010 17:46:38 +0000 (17:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118588 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Attributes.cpp

index c9240e534c73842be24bc179574e52d6f1053140..37a217fc8c5a1a91f6fada3167b48d8178a32b93 100644 (file)
@@ -131,8 +131,8 @@ public:
   }
   void DropRef() {
     sys::SmartScopedLock<true> Lock(*ALMutex);
-    sys::cas_flag old = RefCount++;
-    if (old == 1)
+    sys::cas_flag new_val = RefCount--;
+    if (new_val == 0)
       delete this;
   }