Plug several mbuf leaks in error cases (in nd6)

Submitted by: jhay
This commit is contained in:
bmilekic 2001-03-11 05:31:45 +00:00
parent 93bcc12612
commit dba0ff5a09
3 changed files with 14 additions and 7 deletions

View File

@ -184,8 +184,7 @@ ether_output(ifp, m, dst, rt0)
#ifdef INET6
case AF_INET6:
if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) {
/* this must be impossible, so we bark */
printf("nd6_storelladdr failed\n");
/* Something bad happened */
return(0);
}
off = m->m_pkthdr.len - m->m_len;

View File

@ -180,8 +180,7 @@ fddi_output(ifp, m, dst, rt0)
#ifdef INET6
case AF_INET6:
if (!nd6_storelladdr(&ac->ac_if, rt, m, dst, (u_char *)edst)) {
/* this must be impossible, so we bark */
printf("nd6_storelladdr failed\n");
/* Something bad happened */
return(0);
}
type = htons(ETHERTYPE_IPV6);

View File

@ -970,6 +970,7 @@ nd6_resolve(ifp, rt, m, dst, desten)
return(1);
break;
default:
m_freem(m);
return(0);
}
}
@ -1026,6 +1027,7 @@ nd6_resolve(ifp, rt, m, dst, desten)
ln, 0);
}
}
/* Do not free mbuf chain here as it is queued in llinfo_nd6 */
return(0);
}
#endif /* OLDIP6OUTPUT */
@ -1981,19 +1983,26 @@ nd6_storelladdr(ifp, rt, m, dst, desten)
*desten = 0;
return(1);
default:
m_freem(m);
return(0);
}
}
if (rt == NULL ||
rt->rt_gateway->sa_family != AF_LINK) {
printf("nd6_storelladdr: something odd happens\n");
if (rt == NULL) {
/* This could happen if we could not allocate memory */
m_freem(m);
return(0);
}
if (rt->rt_gateway->sa_family != AF_LINK) {
printf("nd6_storelladdr: something odd happened\n");
m_freem(m);
return(0);
}
sdl = SDL(rt->rt_gateway);
if (sdl->sdl_alen == 0) {
/* this should be impossible, but we bark here for debugging */
printf("nd6_storelladdr: sdl_alen == 0\n");
m_freem(m);
return(0);
}