summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-12-13 08:55:00 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-12-13 08:55:00 +0000
commitf4a558b47743571e516f899836e411a628fc2692 (patch)
tree0d7cc48f8a804e87332be6549d20715e00605f02 /sys/net
parent4fe6eab16a7a9691e70116baa906a4452dc2f0ed (diff)
Sizes for free in route_output().
From kshe59@zoho.eu.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/rtsock.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index e3eda412388..8b87c144601 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.256 2017/12/10 11:25:18 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.257 2017/12/13 08:54:59 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -706,8 +706,9 @@ route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
if (!error) {
type = rtm->rtm_type;
seq = rtm->rtm_seq;
- free(rtm, M_RTABLE, 0);
+ free(rtm, M_RTABLE, len);
rtm = rtm_report(rt, type, seq, tableid);
+ len = rtm->rtm_msglen;
}
}
@@ -725,18 +726,18 @@ route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr,
if (route_cb.any_count <= 1) {
/* no other listener and no loopback of messages */
fail:
- free(rtm, M_RTABLE, 0);
+ free(rtm, M_RTABLE, len);
m_freem(m);
return (error);
}
}
if (rtm) {
- if (m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT)) {
+ if (m_copyback(m, 0, len, rtm, M_NOWAIT)) {
m_freem(m);
m = NULL;
- } else if (m->m_pkthdr.len > rtm->rtm_msglen)
- m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
- free(rtm, M_RTABLE, 0);
+ } else if (m->m_pkthdr.len > len)
+ m_adj(m, len - m->m_pkthdr.len);
+ free(rtm, M_RTABLE, len);
}
if (m)
route_input(m, so, info.rti_info[RTAX_DST] ?