gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32189 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r32189 - gnunet/src/transport
Date: Tue, 4 Feb 2014 13:31:45 +0100

Author: wachs
Date: 2014-02-04 13:31:45 +0100 (Tue, 04 Feb 2014)
New Revision: 32189

Modified:
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
fixing 3299: use after free caused by shutdown order neighbours & plugins



Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2014-02-04 
12:24:07 UTC (rev 32188)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2014-02-04 
12:31:45 UTC (rev 32189)
@@ -799,6 +799,8 @@
       n->primary_address.bandwidth_out);
 }
 
+#if 0
+TODO: Implement this
 /**
  * Clear the primary address of a neighbour since this primary address is not
  * valid anymore and notify monitoring about it
@@ -811,7 +813,9 @@
 
 }
 
+#endif
 
+
 /**
  * Free a neighbour map entry.
  *
@@ -1731,13 +1735,17 @@
   struct QuotaNotificationRequest *qnr;
   struct QNR_LookContext qnr_ctx;
 
+  if (NULL == registered_quota_notifications)
+  {
+    return; /* init or shutdown */
+  }
+
   qnr_ctx.peer = (*peer);
   qnr_ctx.plugin = plugin;
   qnr_ctx.session = session;
   qnr_ctx.res = NULL;
-  int res;
 
-  res = GNUNET_CONTAINER_multipeermap_get_multiple 
(registered_quota_notifications,
+  GNUNET_CONTAINER_multipeermap_get_multiple (registered_quota_notifications,
       peer, &find_notification_request, &qnr_ctx);
   if (NULL != qnr_ctx.res)
   {
@@ -1764,13 +1772,18 @@
     const struct GNUNET_PeerIdentity *peer, const char *plugin, struct Session 
*session)
 {
   struct QNR_LookContext qnr_ctx;
+
+  if (NULL == registered_quota_notifications)
+  {
+    return; /* init or shutdown */
+  }
+
   qnr_ctx.peer = (*peer);
   qnr_ctx.plugin = plugin;
   qnr_ctx.session = session;
   qnr_ctx.res = NULL;
-  int res;
 
-  res = GNUNET_CONTAINER_multipeermap_iterate (registered_quota_notifications,
+  GNUNET_CONTAINER_multipeermap_iterate (registered_quota_notifications,
       &find_notification_request, &qnr_ctx);
   if (NULL == qnr_ctx.res)
   {
@@ -1791,7 +1804,7 @@
 static int
 notification_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
 {
-  struct NeighbourMapEntry *n = cls;
+  /* struct NeighbourMapEntry *n = cls; */
   struct QuotaNotificationRequest *qnr = value;
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct GNUNET_TIME_Relative delay;
@@ -1819,11 +1832,12 @@
 free_notification_cb(void *cls, const struct GNUNET_PeerIdentity *key,
     void *value)
 {
-  struct NeighbourMapEntry *n = cls;
+  /* struct NeighbourMapEntry *n = cls; */
   struct QuotaNotificationRequest *qnr = value;
 
   GNUNET_CONTAINER_multipeermap_remove (registered_quota_notifications, key,
       qnr);
+  GNUNET_free(qnr->plugin);
   GNUNET_free(qnr);
 
   return GNUNET_OK;
@@ -3868,6 +3882,7 @@
   GNUNET_CONTAINER_multipeermap_iterate (registered_quota_notifications,
       &free_notification_cb, NULL);
   GNUNET_CONTAINER_multipeermap_destroy (registered_quota_notifications);
+  registered_quota_notifications = NULL;
 
   neighbours = NULL;
   callback_cls = NULL;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]