From d127311405a23606eee4ad8874b27f6a0a101d22 Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 5 Sep 2018 08:47:21 +0000 Subject: [PATCH] Use error label in host_if() This brings it in line with host() and host_dns(). OK sashan miko --- sbin/pfctl/pfctl_parser.c | 15 ++++++--------- 1 file 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); } -- 2.20.1