gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15099 - in gnunet: . src/core


From: gnunet
Subject: [GNUnet-SVN] r15099 - in gnunet: . src/core
Date: Thu, 28 Apr 2011 19:13:55 +0200

Author: grothoff
Date: 2011-04-28 19:13:55 +0200 (Thu, 28 Apr 2011)
New Revision: 15099

Modified:
   gnunet/TODO
   gnunet/src/core/core_api.c
Log:
fixing leak

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2011-04-28 16:57:36 UTC (rev 15098)
+++ gnunet/TODO 2011-04-28 17:13:55 UTC (rev 15099)
@@ -9,8 +9,7 @@
   - ATS crashes [MW]
   - UDP fragmentation [MW]
 * CORE:
-  - Core API's peer_change_preference leaks 'irc' and
-    Core API's notify_transmit_ready leaks 'th'!
+  - Core API's notify_transmit_ready leaks 'th'!
 * FS [CG]
   - download of 100 MB file from 'leach' peer hung due to 
     failure of core-api to call back after a change preference request
@@ -125,7 +124,6 @@
   - testcase would be nice
   - generic block support for DHT
 * STATISTICS:
-  - test notification-based statistics API
   - implement statistics GUI (=> start from gnunet-gtk by button!)
 * PEERINFO: [NN]
   - move peerinfo to new GUI (=> start from gnunet-gtk by button!)

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2011-04-28 16:57:36 UTC (rev 15098)
+++ gnunet/src/core/core_api.c  2011-04-28 17:13:55 UTC (rev 15099)
@@ -83,6 +83,11 @@
   void *pcic_cls;
 
   /**
+   * Pointer to free when we call pcic.
+   */
+  void *pcic_ptr;
+
+  /**
    * Request information ID for the given pcic (needed in case a
    * request is cancelled after being submitted to core and a new
    * one is generated; in this case, we need to avoid matching the
@@ -419,6 +424,8 @@
   if (NULL != (pcic = pr->pcic))
     {
       pr->pcic = NULL;
+      GNUNET_free_non_null (pr->pcic_ptr);
+      pr->pcic_ptr = NULL;
       pcic (pr->pcic_cls,
            &pr->peer,
            zero,
@@ -1250,6 +1257,8 @@
        }
       pcic = pr->pcic;
       pr->pcic = NULL;
+      GNUNET_free_non_null (pr->pcic_ptr);
+      pr->pcic_ptr = NULL;
       if (pcic != NULL)
        pcic (pr->pcic_cls,
              &pr->peer,
@@ -1902,7 +1911,6 @@
   irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext));
   irc->h = h;
   irc->pr = pr;
-  // FIXME: who frees 'irc'? (if not cancelled?)
   cm = GNUNET_malloc (sizeof (struct ControlMessage) +
                      sizeof (struct RequestInfoMessage));
   cm->cont = &change_preference_send_continuation;
@@ -1925,6 +1933,7 @@
                                    cm); 
   pr->pcic = info;
   pr->pcic_cls = info_cls;
+  pr->pcic_ptr = irc; /* for free'ing irc */
   if (h->control_pending_head == cm)
     trigger_next_request (h, GNUNET_NO);
   return irc;
@@ -1948,6 +1957,7 @@
   struct GNUNET_CORE_Handle *h = irc->h;
   struct PeerRecord *pr = irc->pr;
 
+  GNUNET_assert (pr->pcic_ptr == irc);
   if (irc->cm != NULL)
     {
       GNUNET_CONTAINER_DLL_remove (h->control_pending_head,
@@ -1957,6 +1967,7 @@
     }
   pr->pcic = NULL;
   pr->pcic_cls = NULL;
+  pr->pcic_ptr = NULL;
   GNUNET_free (irc);
 }
 




reply via email to

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