]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4696: Fix leaky String move assignment operator (#858)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 9 Jul 2021 15:32:33 +0000 (15:32 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 11 Jul 2021 15:34:41 +0000 (15:34 +0000)
The original attempt at fixing String move assignment operator (i.e.
commit 20a04c1) leaked the assigned-to String object memory.

These leaks are measurable even in --disable-optimizations builds.

src/SquidString.h

index 3bfaa5989a5a38276177f09e5314971c044e03f6..30f23285fee45136f6f5ee8277b2f2648fc37495 100644 (file)
@@ -42,6 +42,7 @@ public:
     String &operator =(String const &);
     String &operator =(String && S) {
         if (this != &S) {
+            clean();
             size_ = S.size_;
             len_ = S.len_;
             buf_ = S.buf_;