From bdb205c53ed769ad9f5e8da1ec6d05c48992dbf8 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Wed, 1 Oct 2025 11:41:25 +0200 Subject: [PATCH] libpfctl: fix memory leak in pfctl_get_status() Remember to also free ncounters. Fixes: c00aca9a71 ("pf: Show pf fragment reassembly counters.") MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 4b579de38ad..8c4b26b9805 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -561,6 +561,10 @@ pfctl_free_status(struct pfctl_status *status) free(c->name); free(c); } + TAILQ_FOREACH_SAFE(c, &status->ncounters, entry, tmp) { + free(c->name); + free(c); + } free(status); }