aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-10-23 20:39:38 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-02-06 12:21:41 +0000
commit779cb5671946beece1d8bb751a9f58d76bcf70b4 (patch)
tree45911c9c69432d1f89303a0d39bacd437b41bc60 /src
parentb38b04edea16a9c9457415f363ec8d0b5fd98929 (diff)
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 99eefc2cfee4f71e1aaad1d420e6d9335072eb2c)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/ikev2/ikev2.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index 27b8704539a..16c21cb2418 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -244,18 +244,23 @@ ikev2_sa_free_proposal_vector (ikev2_sa_proposal_t ** 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
ikev2_sa_free_all_child_sa (ikev2_child_sa_t ** childs)
{
ikev2_child_sa_t *c;
- vec_foreach (c, *childs)
- {
- 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_foreach (c, *childs) ikev2_sa_free_child_sa (c);
vec_free (*childs);
}
@@ -263,13 +268,7 @@ ikev2_sa_free_all_child_sa (ikev2_child_sa_t ** childs)
static void
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_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);
-
+ ikev2_sa_free_child_sa (child);
vec_del1 (sa->childs, child - sa->childs);
}