From: canacar Date: Wed, 30 Jul 2008 15:07:40 +0000 (+0000) Subject: Call ip6_clearpktopts() on error in copypktopts() instead of freeing X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=951dd902aa258990909793085d532b976dca24c6;p=openbsd Call ip6_clearpktopts() on error in copypktopts() instead of freeing every field individually. ok claudio@ markus@ henning@ deraadt@ --- diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 93d6cd418cb..1442e76ecc7 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.102 2008/06/11 19:00:50 mcbride Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.103 2008/07/30 15:07:40 canacar Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -2253,13 +2253,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