summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl_parser.c
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2018-09-11 09:02:28 +0000
committerkn <kn@cvs.openbsd.org>2018-09-11 09:02:28 +0000
commit6ff2783a80777cfc88d4986c614a9bc346ca4ba8 (patch)
treef0f894c4296c9e205293d7439a91f021073b3127 /sbin/pfctl/pfctl_parser.c
parent1e3c980808b66c2556c061e9b000fb4d3d984ddb (diff)
Remove unused buffer from host()
Left-over from pre-host_ip() times. While here, use __func__. OK henning benno
Diffstat (limited to 'sbin/pfctl/pfctl_parser.c')
-rw-r--r--sbin/pfctl/pfctl_parser.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 10d4ca9a31b..089069dc72e 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.334 2018/09/10 20:53:53 kn Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.335 2018/09/11 09:02:27 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1612,11 +1612,11 @@ host(const char *s, int opts)
{
struct node_host *h = NULL, *n;
int mask = -1;
- char *p, *r, *ps, *if_name;
+ char *p, *ps, *if_name;
const char *errstr;
if ((ps = strdup(s)) == NULL)
- err(1, "host: strdup");
+ err(1, "%s: strdup", __func__);
if ((if_name = strrchr(ps, '@')) != NULL) {
if_name[0] = '\0';
@@ -1624,16 +1624,13 @@ host(const char *s, int opts)
}
if ((p = strrchr(ps, '/')) != NULL) {
- if ((r = strdup(ps)) == NULL)
- err(1, "host: strdup");
mask = strtonum(p+1, 0, 128, &errstr);
if (errstr) {
fprintf(stderr, "netmask is %s: %s\n", errstr, p);
goto error;
}
p[0] = '\0';
- } else
- r = ps;
+ }
if ((h = host_if(ps, mask)) == NULL &&
(h = host_ip(ps, mask)) == NULL &&
@@ -1645,15 +1642,13 @@ host(const char *s, int opts)
if (if_name && if_name[0])
for (n = h; n != NULL; n = n->next)
if ((n->ifname = strdup(if_name)) == NULL)
- err(1, "host: strdup");
+ err(1, "%s: strdup", __func__);
for (n = h; n != NULL; n = n->next) {
n->addr.type = PF_ADDR_ADDRMASK;
n->weight = 0;
}
error:
- if (r != ps)
- free(r);
free(ps);
return (h);
}