The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c31621c125ee4fa60e320781447864ebca5b3173
commit c31621c125ee4fa60e320781447864ebca5b3173 Author: Kristof Provost <k...@freebsd.org> AuthorDate: 2025-06-24 11:43:26 +0000 Commit: Kristof Provost <k...@freebsd.org> CommitDate: 2025-06-27 14:55:17 +0000 pfctl: fix memory leak Be consistent in warn() and log_warn() usage when running out of memory. Next step, be correct *and* consistent. ok dennis@ tb@ benno@ schwarze@ Obtained from: OpenBSD, krw <k...@openbsd.org>, 3c12ada049 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 8afef160b205..41f2d8dc70e7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7143,9 +7143,11 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - if (nfile) + if (nfile) { + warn("strdup"); free(nfile); - warn("malloc"); + } else + warn("calloc"); return (NULL); } if (TAILQ_FIRST(&files) == NULL && strcmp(nfile->name, "-") == 0) {