From c4d0522fd416da83f77475e2bb8351a7b5b72cc3 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sun, 29 Jan 2017 20:07:02 -0600 Subject: [PATCH] Save next pointer in case mqm gets freed --- src/cadet/gnunet-service-cadet-new_peer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cadet/gnunet-service-cadet-new_peer.c b/src/cadet/gnunet-service-cadet-new_peer.c index cc13f6da6..8db375510 100644 --- a/src/cadet/gnunet-service-cadet-new_peer.c +++ b/src/cadet/gnunet-service-cadet-new_peer.c @@ -527,10 +527,12 @@ GCP_set_mq (struct CadetPeer *cp, GCP_2s (cp), mq); cp->core_mq = mq; - for (struct GCP_MessageQueueManager *mqm = cp->mqm_head; + for (struct GCP_MessageQueueManager *mqm = cp->mqm_head, *next; NULL != mqm; - mqm = mqm->next) + mqm = next) { + /* Save next pointer in case mqm gets freed by the callback */ + next = mqm->next; if (NULL == mq) { if (NULL != mqm->env) -- 2.25.1