-fix use after free
authorChristian Grothoff <christian@grothoff.org>
Thu, 22 Sep 2016 11:49:55 +0000 (11:49 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 22 Sep 2016 11:49:55 +0000 (11:49 +0000)
src/cadet/gnunet-service-cadet_peer.c

index 5ccd8f01453921399be6b3c499f087926c811ba5..9fa25a1fa6e97b75fc955fcb3df55436ba6bb916 100644 (file)
@@ -1281,11 +1281,6 @@ GCP_shutdown (void)
     GNUNET_CORE_disconnecT (core_handle);
         core_handle = NULL;
   }
-  if (NULL != ats_ch)
-  {
-    GNUNET_ATS_connectivity_done (ats_ch);
-    ats_ch = NULL;
-  }
   GNUNET_PEER_change_rc (myid, -1);
   /* With MQ API, CORE calls the disconnect handler for every peer
    * after calling GNUNET_CORE_disconnecT, shutdown must occur *after* that.
@@ -1293,6 +1288,11 @@ GCP_shutdown (void)
   GNUNET_CONTAINER_multipeermap_iterate (peers,
                                          &shutdown_peer,
                                          NULL);
+  if (NULL != ats_ch)
+  {
+    GNUNET_ATS_connectivity_done (ats_ch);
+    ats_ch = NULL;
+  }
   GNUNET_CONTAINER_multipeermap_destroy (peers);
   peers = NULL;
 }