From: Alex Rousskov Date: Fri, 9 Jul 2021 15:32:33 +0000 (+0000) Subject: Bug 4696: Fix leaky String move assignment operator (#858) X-Git-Tag: SQUID_6_0_1~314 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c62c979ada334703e017265a352a9c5e8f545b0;p=thirdparty%2Fsquid.git Bug 4696: Fix leaky String move assignment operator (#858) 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. --- diff --git a/src/SquidString.h b/src/SquidString.h index 3bfaa5989a..30f23285fe 100644 --- a/src/SquidString.h +++ b/src/SquidString.h @@ -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_;