From d35b1a2f21b9707a501563d8e4216204bb17dbb8 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Tue, 9 Nov 2010 17:46:38 +0000 Subject: [PATCH] Really fix the leak in the attributes list. Thanks to Benjamin Kramer for pointing out how I was being stupid. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118588 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Attributes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index c9240e534c7..37a217fc8c5 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -131,8 +131,8 @@ public: } void DropRef() { sys::SmartScopedLock Lock(*ALMutex); - sys::cas_flag old = RefCount++; - if (old == 1) + sys::cas_flag new_val = RefCount--; + if (new_val == 0) delete this; }