From bb31efde0afb9875e1145a5501ef50ae4d8005ef Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 17 Jan 2012 15:52:35 +0000 Subject: [PATCH] -fix #2079 --- src/vpn/gnunet-service-vpn.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 0a6eacb14..aa95e429f 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -510,9 +510,13 @@ destroy_tunnel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct TunnelState *ts = cls; + struct GNUNET_MESH_Tunnel *tunnel; ts->destroy_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_MESH_tunnel_destroy (ts->tunnel); + if (NULL == (tunnel = ts->tunnel)) + return; + ts->tunnel = NULL; + GNUNET_MESH_tunnel_destroy (tunnel); } @@ -759,6 +763,7 @@ free_tunnel_state (struct TunnelState *ts) { GNUNET_HashCode key; struct TunnelMessageQueueEntry *tnq; + struct GNUNET_MESH_Tunnel *tunnel; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up tunnel state\n"); @@ -790,10 +795,10 @@ free_tunnel_state (struct TunnelState *ts) ts->th = NULL; } GNUNET_assert (NULL == ts->destination.heap_node); - if (NULL != ts->tunnel) + if (NULL != (tunnel = ts->tunnel)) { - GNUNET_MESH_tunnel_destroy (ts->tunnel); ts->tunnel = NULL; + GNUNET_MESH_tunnel_destroy (tunnel); } if (NULL != ts->heap_node) { -- 2.25.1