fair, global message buffer implemented
[oweals/gnunet.git] / src / cadet / gnunet-service-cadet-new_peer.c
index cc13f6da612a70a7b694c6ef94b71d396801745a..8db375510d93884401a7373f3405579267cca164 100644 (file)
@@ -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)