summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-01-10 09:01:19 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-01-10 09:01:19 +0000
commitbcd3bf54bd9195536c3e1176804a585ec29cf333 (patch)
tree12f8297cc13a5d88fa9700a31c4d0565205f89e9 /sys/netinet
parent37f1b5d5fe9fff46d0b5fffc16c2569ae4b0b749 (diff)
Remove NULL checks before m_free(9), it deals with it.
ok bluhm@, kettenis@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_output.c11
-rw-r--r--sys/netinet/raw_ip.c5
-rw-r--r--sys/netinet/tcp_input.c11
-rw-r--r--sys/netinet/tcp_subr.c5
-rw-r--r--sys/netinet/tcp_usrreq.c5
5 files changed, 14 insertions, 23 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 10b4adaf67c..c1cf4f68cfe 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.333 2016/12/19 09:22:24 rzalamena Exp $ */
+/* $OpenBSD: ip_output.c,v 1.334 2017/01/10 09:01:18 mpi Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1074,8 +1074,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
error = ENOPROTOOPT;
break;
}
- if (m)
- (void)m_free(m);
+ m_free(m);
break;
case PRCO_GETOPT:
@@ -1242,15 +1241,13 @@ ip_pcbopts(struct mbuf **pcbopt, struct mbuf *m)
u_char opt;
/* turn off any old options */
- if (*pcbopt)
- (void)m_free(*pcbopt);
+ m_free(*pcbopt);
*pcbopt = 0;
if (m == NULL || m->m_len == 0) {
/*
* Only turning off any previous options.
*/
- if (m)
- (void)m_free(m);
+ m_free(m);
return (0);
}
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index af87fe9b18d..0282e35682d 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.90 2016/12/19 09:22:24 rzalamena Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.91 2017/01/10 09:01:18 mpi Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -325,8 +325,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
inp->inp_flags |= INP_HDRINCL;
else
inp->inp_flags &= ~INP_HDRINCL;
- if (*mp)
- (void)m_free(*mp);
+ m_free(*mp);
} else {
*mp = m_get(M_WAIT, M_SOOPTS);
(*mp)->m_len = sizeof(int);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index feef7b084a6..610a7ca165f 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.334 2016/12/19 08:36:49 mpi Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.335 2017/01/10 09:01:18 mpi Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3340,8 +3340,7 @@ syn_cache_rm(struct syn_cache *sc)
void
syn_cache_put(struct syn_cache *sc)
{
- if (sc->sc_ipopts)
- (void) m_free(sc->sc_ipopts);
+ m_free(sc->sc_ipopts);
if (sc->sc_route4.ro_rt != NULL) {
rtfree(sc->sc_route4.ro_rt);
sc->sc_route4.ro_rt = NULL;
@@ -4035,8 +4034,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
* If we were remembering a previous source route,
* forget it and use the new one we've been given.
*/
- if (sc->sc_ipopts)
- (void) m_free(sc->sc_ipopts);
+ m_free(sc->sc_ipopts);
sc->sc_ipopts = ipopts;
}
sc->sc_timestamp = tb.ts_recent;
@@ -4049,8 +4047,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
sc = pool_get(&syn_cache_pool, PR_NOWAIT|PR_ZERO);
if (sc == NULL) {
- if (ipopts)
- (void) m_free(ipopts);
+ m_free(ipopts);
return (-1);
}
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index f80d28dc1a1..5729c1bae48 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.157 2016/12/20 09:57:10 mpi Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.158 2017/01/10 09:01:18 mpi Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -534,8 +534,7 @@ tcp_close(struct tcpcb *tp)
p = q;
}
#endif
- if (tp->t_template)
- (void) m_free(tp->t_template);
+ m_free(tp->t_template);
tp->t_flags |= TF_DEAD;
timeout_add(&tp->t_reap_to, 0);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 39705864219..fca2b4ad67f 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.141 2017/01/03 10:52:21 mpi Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.142 2017/01/10 09:01:18 mpi Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -569,8 +569,7 @@ tcp_ctloutput(int op, struct socket *so, int level, int optname,
error = ENOPROTOOPT;
break;
}
- if (m)
- (void) m_free(m);
+ m_free(m);
break;
case PRCO_GETOPT: