fixed a memory leak in unresolved ND queue processing

Obtained from: KAME
MFC after: 1 week
This commit is contained in:
SUZUKI Shinsuke 2007-05-04 02:34:17 +00:00
parent 89290aa383
commit 8d290a593f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169241
2 changed files with 8 additions and 22 deletions

View File

@ -1794,24 +1794,17 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
if (ln->ln_hold) {
struct mbuf *m_hold, *m_hold_next;
for (m_hold = ln->ln_hold; m_hold;
m_hold = m_hold_next) {
struct mbuf *mpkt = NULL;
for (m_hold = ln->ln_hold, ln->ln_hold = NULL;
m_hold; m_hold = m_hold_next) {
m_hold_next = m_hold->m_nextpkt;
mpkt = m_copym(m_hold, 0, M_COPYALL, M_DONTWAIT);
if (mpkt == NULL) {
m_freem(m_hold);
break;
}
mpkt->m_nextpkt = NULL;
m_hold->m_nextpkt = NULL;
/*
* we assume ifp is not a p2p here, so
* just set the 2nd argument as the
* 1st one.
*/
nd6_output(ifp, ifp, mpkt,
nd6_output(ifp, ifp, m_hold,
(struct sockaddr_in6 *)rt_key(rt),
rt);
}

View File

@ -818,24 +818,17 @@ nd6_na_input(m, off, icmp6len)
if (ln->ln_hold) {
struct mbuf *m_hold, *m_hold_next;
for (m_hold = ln->ln_hold; m_hold; m_hold = m_hold_next) {
struct mbuf *mpkt = NULL;
for (m_hold = ln->ln_hold, ln->ln_hold = NULL;
m_hold; m_hold = m_hold_next) {
m_hold_next = m_hold->m_nextpkt;
mpkt = m_copym(m_hold, 0, M_COPYALL, M_DONTWAIT);
if (mpkt == NULL) {
m_freem(m_hold);
break;
}
mpkt->m_nextpkt = NULL;
m_hold->m_nextpkt = NULL;
/*
* we assume ifp is not a loopback here, so just set
* the 2nd argument as the 1st one.
*/
nd6_output(ifp, ifp, mpkt,
nd6_output(ifp, ifp, m_hold,
(struct sockaddr_in6 *)rt_key(rt), rt);
}
ln->ln_hold = NULL;
}
freeit: