From: Christian Grothoff Date: Fri, 17 Feb 2017 20:01:43 +0000 (+0100) Subject: fix loopback disconnect signalling and a few memory leaks X-Git-Tag: taler-0.2.1~152 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=47c8cd67924e0e6ebbdd8b40c52559eaf9d4e435;p=oweals%2Fgnunet.git fix loopback disconnect signalling and a few memory leaks --- diff --git a/src/cadet/cadet_api_new.c b/src/cadet/cadet_api_new.c index 8d778e10e..673764813 100644 --- a/src/cadet/cadet_api_new.c +++ b/src/cadet/cadet_api_new.c @@ -346,6 +346,8 @@ destroy_channel (struct GNUNET_CADET_Channel *ch) if (NULL != ch->disconnects) ch->disconnects (ch->ctx, ch); + if (NULL != ch->pending_env) + GNUNET_MQ_discard (ch->pending_env); GNUNET_MQ_destroy (ch->mq); GNUNET_free (ch); } diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index e94800593..828c3daa7 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -1043,15 +1043,27 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, channel_destroy (ch); return; } - if ( (NULL != ch->head_sent) || - (NULL != ch->owner) || - (NULL != ch->dest) ) + if ( (NULL != ch->head_sent) && + ( (NULL != ch->owner) || + (NULL != ch->dest) ) ) { /* Wait for other end to destroy us as well, and otherwise allow send queue to be transmitted first */ ch->destroy = GNUNET_YES; return; } + if (GNUNET_YES == ch->is_loopback) + { + struct CadetChannelClient *ccc; + + /* Find which end is left... */ + ccc = (NULL != ch->owner) ? ch->owner : ch->dest; + GSC_handle_remote_channel_destroy (ccc->c, + ccc->ccn, + ch); + channel_destroy (ch); + return; + } /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */ switch (ch->state) { diff --git a/src/util/client.c b/src/util/client.c index 4fd971040..1cf819f9d 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -510,6 +510,8 @@ try_unixpath (const char *service_name, GNUNET_free (unixpath); return sock; } + if (NULL != sock) + GNUNET_NETWORK_socket_close (sock); } GNUNET_free_non_null (unixpath); #endif