-/* $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 $ */
/*
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;
}
}
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] ?