From b89cdb958fe8b00ed00e5bdf3fc3d3abba5a41f7 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sun, 23 Jul 2023 01:38:19 +0000 Subject: [PATCH] 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. --- src/acl/AllOf.cc | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.47.2