From 5643c553df4b8797ee43dab0da8fe6896ac5a7e9 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 3 Apr 2017 17:41:13 -0500 Subject: [PATCH] bug fix in add_provider --- routing/dht_protocol.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/routing/dht_protocol.c b/routing/dht_protocol.c index d5b92e0..0b40e24 100644 --- a/routing/dht_protocol.c +++ b/routing/dht_protocol.c @@ -132,11 +132,6 @@ int libp2p_routing_dht_handle_add_provider(struct SessionContext* session, struc if (!libp2p_peerstore_add_peer(peerstore, peer)) goto exit; - libp2p_peer_free(peer); - - if (retVal == 0) - goto exit; - *result_buffer_size = libp2p_message_protobuf_encode_size(message); *result_buffer = (unsigned char*)malloc(*result_buffer_size); if (*result_buffer == NULL) @@ -257,6 +252,8 @@ int libp2p_routing_dht_handle_message(struct SessionContext* session, struct Pee libp2p_logger_debug("dht_protocol", "Sending message back to caller\n"); if (!session->default_stream->write(session, result_buffer, result_buffer_size)) goto exit; + } else { + libp2p_logger_debug("dht_protocol", "Nothing to send back. Kademlia call has been handled\n"); } retVal = 1; exit: