* free() SA variable entry. */
| 3092 | * free() SA variable entry. |
| 3093 | */ |
| 3094 | static void |
| 3095 | key_delsav(struct secasvar *sav) |
| 3096 | { |
| 3097 | IPSEC_ASSERT(sav != NULL, ("null sav")); |
| 3098 | IPSEC_ASSERT(sav->state == SADB_SASTATE_DEAD, |
| 3099 | ("attempt to free non DEAD SA %p", sav)); |
| 3100 | IPSEC_ASSERT(sav->refcnt == 0, ("reference count %u > 0", |
| 3101 | sav->refcnt)); |
| 3102 | |
| 3103 | /* |
| 3104 | * SA must be unlinked from the chain and hashtbl. |
| 3105 | * If SA was cloned, we leave all fields untouched, |
| 3106 | * except NAT-T config. |
| 3107 | */ |
| 3108 | key_cleansav(sav); |
| 3109 | if ((sav->flags & SADB_X_EXT_F_CLONED) == 0) { |
| 3110 | mtx_destroy(sav->lock); |
| 3111 | free(sav->lock, M_IPSEC_MISC); |
| 3112 | uma_zfree_pcpu(V_key_lft_zone, sav->lft_c); |
| 3113 | } |
| 3114 | free(sav, M_IPSEC_SA); |
| 3115 | } |
| 3116 | |
| 3117 | /* |
| 3118 | * search SAH. |
no test coverage detected