diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-01-28 19:23:04 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-01-28 19:23:04 +0000 |
commit | 57c2b8f499605815aad123549db8edb8566fa370 (patch) | |
tree | ecfa98146397989b01a16966dfb6a13d659a844c /src | |
parent | f65049d53b79afe70a5adfbef38d65a5a49208c5 (diff) |
- fixes for NPE
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 2762339ae..4f4214248 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -1389,7 +1389,8 @@ 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; + struct GNUNET_CADET_Channel *recv; + struct GNUNET_CADET_Channel *send; peer_ctx = (struct PeerContext *) value; @@ -1402,25 +1403,27 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value) peer_ctx->is_live_task = NULL; } - if (NULL != peer_ctx->send_channel - && ch != peer_ctx->send_channel) + send = peer_ctx->send_channel; + peer_ctx->send_channel = NULL; + recv = peer_ctx->send_channel; + peer_ctx->recv_channel = NULL; + + if (NULL != send + && ch != send) { - destroy = peer_ctx->send_channel; - peer_ctx->send_channel = NULL; - GNUNET_CADET_channel_destroy (destroy); + GNUNET_CADET_channel_destroy (send); } - if (NULL != peer_ctx->recv_channel - && ch != peer_ctx->recv_channel) + if (NULL != recv + && ch != recv) { - destroy = peer_ctx->recv_channel; - peer_ctx->recv_channel = NULL; - GNUNET_CADET_channel_destroy (destroy); + GNUNET_CADET_channel_destroy (recv); } if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key)) LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n"); + /* FIXME this will be called twice until the fixme in line 1451 is fixed */ GNUNET_free (peer_ctx); return GNUNET_YES; } |