The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5c9b1c7e5f271a18ed07b595240b487509bdcac3

commit 5c9b1c7e5f271a18ed07b595240b487509bdcac3
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2025-06-27 14:25:53 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2025-07-02 07:40:54 +0000

    pfctl: Allocate path only when needed, use __func__
    
    Obtained from:  OpenBSD, kn <k...@openbsd.org>, e56235b48a
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/pfctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 79076fc69776..21befd3ca697 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -3192,8 +3192,6 @@ main(int argc, char *argv[])
        if (loadopt == 0)
                loadopt = ~0;
 
-       if ((path = calloc(1, MAXPATHLEN)) == NULL)
-               errx(1, "pfctl: calloc");
        memset(anchorname, 0, sizeof(anchorname));
        if (anchoropt != NULL) {
                int len = strlen(anchoropt);
@@ -3247,6 +3245,9 @@ main(int argc, char *argv[])
                if (pfctl_disable(dev, opts))
                        error = 1;
 
+       if ((path = calloc(1, MAXPATHLEN)) == NULL)
+               errx(1, "%s: calloc", __func__);
+
        if (showopt != NULL) {
                switch (*showopt) {
                case 'A':

Reply via email to