summaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 34acba2fc..fe5db5e6f 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1388,6 +1388,7 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct PeerContext *peer_ctx;
const struct GNUNET_CADET_Channel *ch = (const struct GNUNET_CADET_Channel *) cls;
+ struct GNUNET_CADET_Channel *destroy;
peer_ctx = (struct PeerContext *) value;
@@ -1402,11 +1403,19 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
if (NULL != peer_ctx->send_channel
&& ch != peer_ctx->send_channel)
- GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
+ {
+ destroy = peer_ctx->send_channel;
+ peer_ctx->send_channel = NULL;
+ GNUNET_CADET_channel_destroy (destroy);
+ }
if (NULL != peer_ctx->recv_channel
&& ch != peer_ctx->recv_channel)
- GNUNET_CADET_channel_destroy (peer_ctx->recv_channel);
+ {
+ destroy = peer_ctx->recv_channel;
+ peer_ctx->recv_channel = NULL;
+ GNUNET_CADET_channel_destroy (destroy);
+ }
if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key))
LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n");