]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix RefCount move assignment
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 20 Feb 2015 10:16:12 +0000 (11:16 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 20 Feb 2015 10:16:12 +0000 (11:16 +0100)
src/base/RefCount.h

index 84605a8f66e2b5f4d03f59b42d40ec32ab20e2cf..e0c6926a28c4d6bfbe4d3f1c7513da75ccf8d696 100644 (file)
@@ -53,9 +53,12 @@ public:
     }
 
     RefCount& operator = (RefCount&& p) {
-        p_ = std::move(p.p_);
-        p.p_ = NULL;
-        return *this;
+        if (this != &p) {
+            dereference(p_);
+            p_ = std::move(p.p_);
+            p.p_ = NULL;
+        }
+        return *this
     }
 
     bool operator !() const { return !p_; }