diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-17 21:01:43 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-17 21:01:43 +0100 |
commit | 47c8cd67924e0e6ebbdd8b40c52559eaf9d4e435 (patch) | |
tree | 441dd4fff65bb3c9e2d7e2ca4c2afacbbc559223 | |
parent | cbafa8e54f0399bf4213c313a72907ba92250375 (diff) | |
download | gnunet-47c8cd67924e0e6ebbdd8b40c52559eaf9d4e435.tar.gz gnunet-47c8cd67924e0e6ebbdd8b40c52559eaf9d4e435.zip |
fix loopback disconnect signalling and a few memory leaks
-rw-r--r-- | src/cadet/cadet_api_new.c | 2 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.c | 18 | ||||
-rw-r--r-- | src/util/client.c | 2 |
3 files changed, 19 insertions, 3 deletions
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) | |||
346 | if (NULL != ch->disconnects) | 346 | if (NULL != ch->disconnects) |
347 | ch->disconnects (ch->ctx, | 347 | ch->disconnects (ch->ctx, |
348 | ch); | 348 | ch); |
349 | if (NULL != ch->pending_env) | ||
350 | GNUNET_MQ_discard (ch->pending_env); | ||
349 | GNUNET_MQ_destroy (ch->mq); | 351 | GNUNET_MQ_destroy (ch->mq); |
350 | GNUNET_free (ch); | 352 | GNUNET_free (ch); |
351 | } | 353 | } |
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, | |||
1043 | channel_destroy (ch); | 1043 | channel_destroy (ch); |
1044 | return; | 1044 | return; |
1045 | } | 1045 | } |
1046 | if ( (NULL != ch->head_sent) || | 1046 | if ( (NULL != ch->head_sent) && |
1047 | (NULL != ch->owner) || | 1047 | ( (NULL != ch->owner) || |
1048 | (NULL != ch->dest) ) | 1048 | (NULL != ch->dest) ) ) |
1049 | { | 1049 | { |
1050 | /* Wait for other end to destroy us as well, | 1050 | /* Wait for other end to destroy us as well, |
1051 | and otherwise allow send queue to be transmitted first */ | 1051 | and otherwise allow send queue to be transmitted first */ |
1052 | ch->destroy = GNUNET_YES; | 1052 | ch->destroy = GNUNET_YES; |
1053 | return; | 1053 | return; |
1054 | } | 1054 | } |
1055 | if (GNUNET_YES == ch->is_loopback) | ||
1056 | { | ||
1057 | struct CadetChannelClient *ccc; | ||
1058 | |||
1059 | /* Find which end is left... */ | ||
1060 | ccc = (NULL != ch->owner) ? ch->owner : ch->dest; | ||
1061 | GSC_handle_remote_channel_destroy (ccc->c, | ||
1062 | ccc->ccn, | ||
1063 | ch); | ||
1064 | channel_destroy (ch); | ||
1065 | return; | ||
1066 | } | ||
1055 | /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */ | 1067 | /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */ |
1056 | switch (ch->state) | 1068 | switch (ch->state) |
1057 | { | 1069 | { |
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, | |||
510 | GNUNET_free (unixpath); | 510 | GNUNET_free (unixpath); |
511 | return sock; | 511 | return sock; |
512 | } | 512 | } |
513 | if (NULL != sock) | ||
514 | GNUNET_NETWORK_socket_close (sock); | ||
513 | } | 515 | } |
514 | GNUNET_free_non_null (unixpath); | 516 | GNUNET_free_non_null (unixpath); |
515 | #endif | 517 | #endif |