Correct reference counting on the SP for outgoing IPv6 IPsec connections.

PR:		121374
Reported by:	Cyrus Rahman (crahman gmail.com)
Tested by:	Cyrus Rahman (crahman gmail.com)
MFC after:	5 days
This commit is contained in:
Bjoern A. Zeeb 2008-03-14 11:55:04 +00:00
parent 39d8cf90cb
commit 8cfbd2995b
2 changed files with 5 additions and 7 deletions

View File

@ -257,7 +257,7 @@ ip6_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error,
* NB: null pointer to avoid free at
* done: below.
*/
KEY_FREESP(sp), sp = NULL;
KEY_FREESP(sp), *sp = NULL;
/* XXX splx(s); */
goto done;
}
@ -298,16 +298,10 @@ ip6_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error,
}
}
done:
if (sp != NULL)
if (*sp != NULL)
KEY_FREESP(sp);
return 0;
do_ipsec:
return -1;
bad:
if (sp != NULL)
if (*sp != NULL)
KEY_FREESP(sp);
return 1;
#endif /* IPSEC */
return 0;

View File

@ -1082,6 +1082,10 @@ skip_ipsec2:;
} else if (ro_pmtu == &ip6route && ro_pmtu->ro_rt) {
RTFREE(ro_pmtu->ro_rt);
}
#ifdef IPSEC
if (sp != NULL)
KEY_FREESP(&sp);
#endif
return (error);