diff options
author | kn <kn@cvs.openbsd.org> | 2018-09-05 08:47:22 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2018-09-05 08:47:22 +0000 |
commit | b6a4f0aba7c4cc9d8b4c1517faa9a6ac04a04afb (patch) | |
tree | 78cdad034de9cc9bbded4a71f946f73a6def6104 | |
parent | e608f80deb5db8fb485e8b46c45be2313a8c10ba (diff) |
Use error label in host_if()
This brings it in line with host() and host_dns().
OK sashan miko
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index a670d093b7c..74c0df4a30d 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.327 2018/08/10 09:54:06 kn Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.328 2018/09/05 08:47:21 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1694,22 +1694,18 @@ host_if(const char *s, int mask) flags |= PFI_AFLAG_PEER; else if (!strcmp(p+1, "0")) flags |= PFI_AFLAG_NOALIAS; - else { - free(ps); - return (NULL); - } + else + goto error; *p = '\0'; } if (flags & (flags - 1) & PFI_AFLAG_MODEMASK) { /* Yep! */ fprintf(stderr, "illegal combination of interface modifiers\n"); - free(ps); - return (NULL); + goto error; } if ((flags & (PFI_AFLAG_NETWORK|PFI_AFLAG_BROADCAST)) && mask > -1) { fprintf(stderr, "network or broadcast lookup, but " "extra netmask given\n"); - free(ps); - return (NULL); + goto error; } if (ifa_exists(ps) || !strncmp(ps, "self", IFNAMSIZ)) { /* interface with this name exists */ @@ -1718,6 +1714,7 @@ host_if(const char *s, int mask) set_ipmask(n, mask); } +error: free(ps); return (h); } |