diff options
author | 2015-09-12 11:40:04 +0000 | |
---|---|---|
committer | 2015-09-12 11:40:04 +0000 | |
commit | 2f75e31f574192d3db9b051f93114ee77175755a (patch) | |
tree | edfa246c5e617fb160673cc3ad9df11fdb7213d3 /sys/netinet/ip_output.c | |
parent | show a few more lines of trace; discussed in the room (diff) | |
download | wireguard-openbsd-2f75e31f574192d3db9b051f93114ee77175755a.tar.xz wireguard-openbsd-2f75e31f574192d3db9b051f93114ee77175755a.zip |
Fix two cases where it was possible to call if_put with an uninitialized ifp
Found by jsg@ with clang
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index ac32d1573bc..1fd63d8b22b 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.293 2015/09/11 19:17:47 claudio Exp $ */ +/* $OpenBSD: ip_output.c,v 1.294 2015/09/12 11:40:04 claudio Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -89,7 +89,7 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, struct ip_moptions *imo, struct inpcb *inp, u_int32_t ipsecflowinfo) { struct ip *ip; - struct ifnet *ifp; + struct ifnet *ifp = NULL; struct mbuf *m = m0; int hlen = sizeof (struct ip); int len, error = 0; @@ -1617,10 +1617,10 @@ ip_getmoptions(int optname, struct ip_moptions *imo, struct mbuf **mp) addr->s_addr = INADDR_ANY; else { IFP_TO_IA(ifp, ia); + if_put(ifp); addr->s_addr = (ia == NULL) ? INADDR_ANY : ia->ia_addr.sin_addr.s_addr; } - if_put(ifp); return (0); case IP_MULTICAST_TTL: |