Skip to content

Commit

Permalink
Fix memory leak when reconfiguring multiline all-of ACLs (#1425)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rousskov authored and yadij committed Jul 25, 2023
1 parent dde7b8e commit b89cdb9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/acl/AllOf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b89cdb9

Please sign in to comment.