diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2001-03-11 05:31:45 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2001-03-11 05:31:45 +0000 |
commit | fb0fa1fa59573248459a2e0105f13219f3df27ef (patch) | |
tree | 24ba52633811ae7bcfa2986d2cbb44697274199c /sys/netinet6/nd6.c | |
parent | 93e4f3d80c06e39e970672bc23331a5b9da183b5 (diff) | |
download | FreeBSD-src-fb0fa1fa59573248459a2e0105f13219f3df27ef.zip FreeBSD-src-fb0fa1fa59573248459a2e0105f13219f3df27ef.tar.gz |
Plug several mbuf leaks in error cases (in nd6)
Submitted by: jhay
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r-- | sys/netinet6/nd6.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index a4ddfa1..833e902 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -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); } |