From: kn Date: Sat, 8 Sep 2018 14:45:55 +0000 (+0000) Subject: Allocate path only when needed, use __func__ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e56235b48ab3fb9ce2b80c9d06c40fc2cec1acaf;p=openbsd Allocate path only when needed, use __func__ --- 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':