MCPcopy Create free account
hub / github.com/F-Stack/f-stack / key_cleansav

Function key_cleansav

freebsd/netipsec/key.c:3051–3089  ·  view source on GitHub ↗

* free() SA variable entry. */

Source from the content-addressed store, hash-verified

3049 * free() SA variable entry.
3050 */
3051static void
3052key_cleansav(struct secasvar *sav)
3053{
3054
3055 if (sav->natt != NULL) {
3056 free(sav->natt, M_IPSEC_MISC);
3057 sav->natt = NULL;
3058 }
3059 if (sav->flags & SADB_X_EXT_F_CLONED)
3060 return;
3061 if (sav->tdb_xform != NULL) {
3062 sav->tdb_xform->xf_cleanup(sav);
3063 sav->tdb_xform = NULL;
3064 }
3065 if (sav->key_auth != NULL) {
3066 zfree(sav->key_auth->key_data, M_IPSEC_MISC);
3067 free(sav->key_auth, M_IPSEC_MISC);
3068 sav->key_auth = NULL;
3069 }
3070 if (sav->key_enc != NULL) {
3071 zfree(sav->key_enc->key_data, M_IPSEC_MISC);
3072 free(sav->key_enc, M_IPSEC_MISC);
3073 sav->key_enc = NULL;
3074 }
3075 if (sav->replay != NULL) {
3076 if (sav->replay->bitmap != NULL)
3077 free(sav->replay->bitmap, M_IPSEC_MISC);
3078 free(sav->replay, M_IPSEC_MISC);
3079 sav->replay = NULL;
3080 }
3081 if (sav->lft_h != NULL) {
3082 free(sav->lft_h, M_IPSEC_MISC);
3083 sav->lft_h = NULL;
3084 }
3085 if (sav->lft_s != NULL) {
3086 free(sav->lft_s, M_IPSEC_MISC);
3087 sav->lft_s = NULL;
3088 }
3089}
3090
3091/*
3092 * free() SA variable entry.

Callers 2

key_delsavFunction · 0.85
key_setsavalFunction · 0.85

Calls 2

freeFunction · 0.50
zfreeFunction · 0.50

Tested by

no test coverage detected