From a0d960700a3dca5bf07f0cc1dc13a1801c4a7c3b Mon Sep 17 00:00:00 2001 From: Carlo von lynX Date: Fri, 29 Jul 2016 21:17:38 +0000 Subject: [PATCH] cadet: rollback + warning message for posterity --- src/cadet/gnunet-service-cadet_peer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index fa338f13f..f9117953d 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -787,13 +787,12 @@ peer_destroy (struct CadetPeer *peer) GNUNET_ATS_connectivity_suggest_cancel (peer->connectivity_suggestion); peer->connectivity_suggestion = NULL; } - /* Following check was 'while' instead of 'if', but GCP_queue_destroy - * frees 'peer->queue_head' so the while checks on freed memory. - * Not sure if 'if' is what you wanted, but 'while' can't be - * correct. --lynX - */ - if (NULL != peer->queue_head) + while (NULL != peer->queue_head) { + /* This function destroys the current peer->queue_head but + * replaces it with the next in the queue, so it is correct + * to while() here. + */ GCP_queue_destroy (peer->queue_head, GNUNET_YES, GNUNET_NO, 0); } if (NULL != peer->core_transmit) -- 2.25.1