/* NB: callee frees mbuf */
*error = ipsec4_process_packet(*m, sp->req);
- /* Release SP if an error occured */
- if (*error != 0)
- KEY_FREESP(&sp);
+ KEY_FREESP(&sp);
if (*error == EJUSTRETURN) {
/*
* We had a SP with a level of 'use' and no SA. We
/* NB: callee frees mbuf */
*error = ipsec6_process_packet(*m, sp->req);
- /* Release SP if an error occured */
- if (*error != 0)
- KEY_FREESP(&sp);
+ KEY_FREESP(&sp);
if (*error == EJUSTRETURN) {
/*
* We had a SP with a level of 'use' and no SA. We
* If this is a problem we'll need to introduce a queue
* to set the packet on so we can unwind the stack before
* doing further processing.
- *
- * If ipsec[46]_process_packet() will successfully queue
- * the request, we need to take additional reference to SP,
- * because xform callback will release reference.
*/
if (isr->next) {
/* XXX-BZ currently only support same AF bundles. */
#ifdef INET
case AF_INET:
IPSECSTAT_INC(ips_out_bundlesa);
- key_addref(isr->sp);
- error = ipsec4_process_packet(m, isr->next);
- if (error != 0)
- KEY_FREESP(&isr->sp);
- return (error);
+ return (ipsec4_process_packet(m, isr->next));
/* NOTREACHED */
#endif
#ifdef notyet
case AF_INET6:
/* XXX */
IPSEC6STAT_INC(ips_out_bundlesa);
- key_addref(isr->sp);
- error = ipsec6_process_packet(m, isr->next);
- if (error != 0)
- KEY_FREESP(&isr->sp);
- return (error);
+ return (ipsec6_process_packet(m, isr->next));
/* NOTREACHED */
#endif /* INET6 */
#endif