From 22eb104fa86f094867f40dba68f65f8f55f7e64a Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 14 Nov 2013 17:46:23 +0000 Subject: [PATCH] - fix memleak on KX drop --- src/mesh/gnunet-service-mesh_tunnel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 1d51ab835..d4ceead50 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -744,10 +744,13 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; - t->kx_ctx = GNUNET_new (struct MeshTunnelKXCtx); - t->kx_ctx->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, - UINT32_MAX); - t->kx_ctx->d_key_old = t->d_key; + if (NULL == t->kx_ctx) + { + t->kx_ctx = GNUNET_new (struct MeshTunnelKXCtx); + t->kx_ctx->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, + UINT32_MAX); + t->kx_ctx->d_key_old = t->d_key; + } send_ephemeral (t); if (MESH_TUNNEL3_READY == t->state || MESH_TUNNEL3_REKEY == t->state) { -- 2.25.1