git: be47dc1f7132 - stable/14 - libpfctl: allow pfctl_free_status(NULL)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Sep 2023 11:51:16 UTC
The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=be47dc1f713217358f882794a85361206f562109 commit be47dc1f713217358f882794a85361206f562109 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-08-29 15:02:34 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-09-09 09:05:50 +0000 libpfctl: allow pfctl_free_status(NULL) Mimic free() and friends, and allow free()ing of NULL. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D41648 (cherry picked from commit 0b01878fd00b128ce3dead119b37781048744d39) --- lib/libpfctl/libpfctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index f98b43f62cda..7d79d0abb970 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -257,6 +257,9 @@ pfctl_free_status(struct pfctl_status *status) { struct pfctl_status_counter *c, *tmp; + if (status == NULL) + return; + TAILQ_FOREACH_SAFE(c, &status->counters, entry, tmp) { free(c->name); free(c);