ikev2: fix memory leak in child SA
traffic selector vector isn't freed when freeing child SA
Type: fix
Change-Id: Icf6c240db5093f45d141451bad6f6627a61821cf
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
(cherry picked from commit 99eefc2cfe
)
This commit is contained in:

committed by
Andrew Yourtchenko

parent
b38b04edea
commit
779cb56719
@@ -243,19 +243,24 @@ ikev2_sa_free_proposal_vector (ikev2_sa_proposal_t ** v)
|
|||||||
vec_free (*v);
|
vec_free (*v);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
ikev2_sa_free_child_sa (ikev2_child_sa_t * c)
|
||||||
|
{
|
||||||
|
ikev2_sa_free_proposal_vector (&c->r_proposals);
|
||||||
|
ikev2_sa_free_proposal_vector (&c->i_proposals);
|
||||||
|
vec_free (c->sk_ai);
|
||||||
|
vec_free (c->sk_ar);
|
||||||
|
vec_free (c->sk_ei);
|
||||||
|
vec_free (c->sk_er);
|
||||||
|
vec_free (c->tsi);
|
||||||
|
vec_free (c->tsr);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ikev2_sa_free_all_child_sa (ikev2_child_sa_t ** childs)
|
ikev2_sa_free_all_child_sa (ikev2_child_sa_t ** childs)
|
||||||
{
|
{
|
||||||
ikev2_child_sa_t *c;
|
ikev2_child_sa_t *c;
|
||||||
vec_foreach (c, *childs)
|
vec_foreach (c, *childs) ikev2_sa_free_child_sa (c);
|
||||||
{
|
|
||||||
ikev2_sa_free_proposal_vector (&c->r_proposals);
|
|
||||||
ikev2_sa_free_proposal_vector (&c->i_proposals);
|
|
||||||
vec_free (c->sk_ai);
|
|
||||||
vec_free (c->sk_ar);
|
|
||||||
vec_free (c->sk_ei);
|
|
||||||
vec_free (c->sk_er);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec_free (*childs);
|
vec_free (*childs);
|
||||||
}
|
}
|
||||||
@@ -263,13 +268,7 @@ ikev2_sa_free_all_child_sa (ikev2_child_sa_t ** childs)
|
|||||||
static void
|
static void
|
||||||
ikev2_sa_del_child_sa (ikev2_sa_t * sa, ikev2_child_sa_t * child)
|
ikev2_sa_del_child_sa (ikev2_sa_t * sa, ikev2_child_sa_t * child)
|
||||||
{
|
{
|
||||||
ikev2_sa_free_proposal_vector (&child->r_proposals);
|
ikev2_sa_free_child_sa (child);
|
||||||
ikev2_sa_free_proposal_vector (&child->i_proposals);
|
|
||||||
vec_free (child->sk_ai);
|
|
||||||
vec_free (child->sk_ar);
|
|
||||||
vec_free (child->sk_ei);
|
|
||||||
vec_free (child->sk_er);
|
|
||||||
|
|
||||||
vec_del1 (sa->childs, child - sa->childs);
|
vec_del1 (sa->childs, child - sa->childs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user