Instead of manually freeing the packet options structure (and not even doing

a good job of it) in the copypktopts() function, just call ip6_clearpktopts()
directly. Otherwise, the callers of this function would end up freeing the
memory twice.

Reviewed by: jinmei
PR:	     kern/116360
This commit is contained in:
mtm 2007-11-21 16:01:42 +00:00
parent e7409e54d4
commit 46c3db4ab1

View File

@ -2361,12 +2361,7 @@ copypktopts(struct ip6_pktopts *dst, struct ip6_pktopts *src, int canwait)
return (0);
bad:
if (dst->ip6po_pktinfo) free(dst->ip6po_pktinfo, M_IP6OPT);
if (dst->ip6po_nexthop) free(dst->ip6po_nexthop, M_IP6OPT);
if (dst->ip6po_hbh) free(dst->ip6po_hbh, M_IP6OPT);
if (dst->ip6po_dest1) free(dst->ip6po_dest1, M_IP6OPT);
if (dst->ip6po_dest2) free(dst->ip6po_dest2, M_IP6OPT);
if (dst->ip6po_rthdr) free(dst->ip6po_rthdr, M_IP6OPT);
ip6_clearpktopts(dst, -1);
return (ENOBUFS);
}
#undef PKTOPT_EXTHDRCPY