]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix memory leak when reconfiguring multiline all-of ACLs (#1425)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 23 Jul 2023 01:38:19 +0000 (01:38 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 25 Jul 2023 14:59:56 +0000 (02:59 +1200)
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.

src/acl/AllOf.cc

index bb914b54078372ef99d5e6457b7fbb98d2c1034e..03365c490814922c04e26912aea3ba8c1ff564a2 100644 (file)
@@ -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;