summaryrefslogtreecommitdiff
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-07-15 22:16:43 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-07-15 22:16:43 +0000
commit5e8589374c930031aaf4735e952691c378a260b8 (patch)
tree158957edef63bb7cac587a2b4370754b04559bae /sys/netinet/raw_ip.c
parenta763f70dd81e802e555963fb255d7538e879b607 (diff)
m_freem() can handle NULL, do not check for this condition beforehands.
ok stsp mpi
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 573a9a0e6d9..5fe8fc95742 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.81 2015/06/30 15:30:17 mpi Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.82 2015/07/15 22:16:42 deraadt Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -169,8 +169,7 @@ rip_input(struct mbuf *m, ...)
sintosa(&ripsrc), n, opts) == 0) {
/* should notify about lost packet */
m_freem(n);
- if (opts)
- m_freem(opts);
+ m_freem(opts);
} else
sorwakeup(last->inp_socket);
opts = NULL;
@@ -185,8 +184,7 @@ rip_input(struct mbuf *m, ...)
if (sbappendaddr(&last->inp_socket->so_rcv, sintosa(&ripsrc), m,
opts) == 0) {
m_freem(m);
- if (opts)
- m_freem(opts);
+ m_freem(opts);
} else
sorwakeup(last->inp_socket);
} else {
@@ -303,7 +301,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
int dir;
if (level != IPPROTO_IP) {
- if (op == PRCO_SETOPT && *m)
+ if (op == PRCO_SETOPT)
(void) m_free(*m);
return (EINVAL);
}
@@ -357,7 +355,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
break;
}
- if (op == PRCO_SETOPT && *m)
+ if (op == PRCO_SETOPT)
(void)m_free(*m);
return (error);
@@ -385,7 +383,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
}
return (error);
#else
- if (op == PRCO_SETOPT && *m)
+ if (op == PRCO_SETOPT)
m_free(*m);
return (EOPNOTSUPP);
#endif
@@ -565,7 +563,6 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
panic("rip_usrreq");
}
release:
- if (m != NULL)
- m_freem(m);
+ m_freem(m);
return (error);
}