summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-01-07 06:03:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-01-07 06:03:29 +0000
commit295ce5eae351f319add00a5414929fe54cbdef05 (patch)
tree4fa1fae56893ddd3478eb73005666ea70a191ab1
parentb3625e58b3cb595f79e0bb077668a507d67118f9 (diff)
fix IFAFREE() to be safe for if/else nesting
-rw-r--r--sys/net/if.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index a9893df142e..d8df7aa835d 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.8 1998/09/03 06:24:20 jason Exp $ */
+/* $OpenBSD: if.h,v 1.9 1999/01/07 06:03:28 deraadt Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -333,11 +333,12 @@ struct ifconf {
#include <net/if_arp.h>
#ifdef _KERNEL
-#define IFAFREE(ifa) \
+#define IFAFREE(ifa) { \
if ((ifa)->ifa_refcnt <= 0) \
ifafree(ifa); \
else \
- (ifa)->ifa_refcnt--;
+ (ifa)->ifa_refcnt--; \
+ }
struct ifnet_head ifnet;