From: Alex Rousskov Date: Sun, 23 Jul 2023 01:38:19 +0000 (+0000) Subject: Fix memory leak when reconfiguring multiline all-of ACLs (#1425) X-Git-Tag: SQUID_7_0_1~389 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8095d0c8c93d5af5f95d363d56c4e58e69eeef6d;p=thirdparty%2Fsquid.git Fix memory leak when reconfiguring multiline all-of ACLs (#1425) Normally, Acl::InnerNode::add() automatically registers stored ACL nodes for future cleanup, but when we find the second all-of rule/line (with the same ACL name), we do not add() the newly created OrNode and have to explicitly register it to avoid memory leaks on reconfiguration. Leaking since all-of ACL support was added in 2013 commit 6f58d7d. --- diff --git a/src/acl/AllOf.cc b/src/acl/AllOf.cc index bb914b5407..03365c4908 100644 --- a/src/acl/AllOf.cc +++ b/src/acl/AllOf.cc @@ -10,6 +10,7 @@ #include "acl/AllOf.h" #include "acl/BoolOps.h" #include "acl/Checklist.h" +#include "acl/Gadgets.h" #include "cache_cf.h" #include "MemBuf.h" #include "sbuf/SBuf.h" @@ -64,6 +65,7 @@ Acl::AllOf::parse() newWhole->context(wholeCtx.content(), oldNode->cfgline); newWhole->add(oldNode); // old (i.e. first) line nodes.front() = whole = newWhole; + aclRegister(newWhole); } else { // this is the first line for this acl; just use it as is whole = this;