summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--src/core/core_api.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/TODO b/TODO
index 87c29b03d..446324433 100644
--- a/TODO
+++ b/TODO
@@ -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!)
diff --git a/src/core/core_api.c b/src/core/core_api.c
index efb00c111..1d61cf96b 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -83,6 +83,11 @@ struct PeerRecord
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 @@ disconnect_and_free_peer_entry (void *cls,
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 @@ main_notify_handler (void *cls,
}
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 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
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 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
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 @@ GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequest
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 @@ GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequest
}
pr->pcic = NULL;
pr->pcic_cls = NULL;
+ pr->pcic_ptr = NULL;
GNUNET_free (irc);
}