summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2020-10-05 12:30:44 +0000
committerBeno�t Ganne <bganne@cisco.com>2020-10-13 09:48:41 +0000
commit623d87fd39c53e2f4d8718014e76836fe07c4245 (patch)
tree45da581e8a78d58b6dfa7d1d4289aa9ce55e3405
parent3a97a456ab27d21d7b25bb5505d93b0d96ab4cab (diff)
ikev2: fix memory leak in auth routine
Type: fix Change-Id: I93529b069925fcef32cdb22e27975b802b4c3b97 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--src/plugins/ikev2/ikev2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index 7931322146c..44528e1fdaf 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -1671,11 +1671,13 @@ ikev2_sa_auth (ikev2_sa_t * sa)
authmsg = ikev2_sa_generate_authmsg (sa, 1);
if (sel_p->auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
{
+ vec_free (sa->r_auth.data);
sa->r_auth.data = ikev2_calc_prf (tr_prf, psk, authmsg);
sa->r_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
}
else if (sel_p->auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
{
+ vec_free (sa->r_auth.data);
sa->r_auth.data = ikev2_calc_sign (km->pkey, authmsg);
sa->r_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
}
@@ -1732,11 +1734,13 @@ ikev2_sa_auth_init (ikev2_sa_t * sa)
if (sa->i_auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
{
+ vec_free (sa->i_auth.data);
sa->i_auth.data = ikev2_calc_prf (tr_prf, psk, authmsg);
sa->i_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
}
else if (sa->i_auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
{
+ vec_free (sa->i_auth.data);
sa->i_auth.data = ikev2_calc_sign (km->pkey, authmsg);
sa->i_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
}