From e56235b48ab3fb9ce2b80c9d06c40fc2cec1acaf Mon Sep 17 00:00:00 2001 From: kn Date: Sat, 8 Sep 2018 14:45:55 +0000 Subject: [PATCH] Allocate path only when needed, use __func__ --- sbin/pfctl/pfctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index f65ebb77254..b08f7302337 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.358 2018/09/08 14:12:57 kn Exp $ */ +/* $OpenBSD: pfctl.c,v 1.359 2018/09/08 14:45:55 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2496,8 +2496,6 @@ main(int argc, char *argv[]) /* NOTREACHED */ } - if ((path = calloc(1, PATH_MAX)) == NULL) - errx(1, "pfctl: calloc"); memset(anchorname, 0, sizeof(anchorname)); if (anchoropt != NULL) { if (mode == O_RDONLY && showopt == NULL) { @@ -2541,6 +2539,9 @@ main(int argc, char *argv[]) if (pfctl_disable(dev, opts)) error = 1; + if ((path = calloc(1, PATH_MAX)) == NULL) + errx(1, "%s: calloc", __func__); + if (showopt != NULL) { switch (*showopt) { case 'A': -- 2.20.1