- fix for access of freed meter after ctrl-c
authorBart Polot <bart@net.in.tum.de>
Tue, 14 Feb 2012 10:35:31 +0000 (10:35 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 14 Feb 2012 10:35:31 +0000 (10:35 +0000)
src/testing/testing_peergroup.c

index a34cb5abe243ad6dbabafd57740af08f8b9e3b47..0421b000a6a24852d586d408a87ea76a354b2d2b 100644 (file)
@@ -463,6 +463,16 @@ internal_topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
   }
 }
 
+
+/**
+ * Callback called for each started daemon.
+ *
+ * @param cls Clause (PG Context).
+ * @param id PeerIdentidy of started daemon.
+ * @param cfg Configuration used by the daemon.
+ * @param d Handle for the daemon.
+ * @param emsg Error message, NULL on success.
+ */
 static void
 internal_peers_started_callback (void *cls,
                                  const struct GNUNET_PeerIdentity *id,
@@ -488,6 +498,11 @@ internal_peers_started_callback (void *cls,
 
   pg_start_ctx->peers_left--;
 
+  if (NULL == pg_start_ctx->peer_start_meter)
+  {
+    /* Cancelled Ctrl-C or error */
+    return;
+  }
   if (GNUNET_YES == update_meter (pg_start_ctx->peer_start_meter))
   {
 #if VERBOSE