diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | src/core/core_api.c | 13 |
2 files changed, 13 insertions, 4 deletions
@@ -9,8 +9,7 @@ | |||
9 | - ATS crashes [MW] | 9 | - ATS crashes [MW] |
10 | - UDP fragmentation [MW] | 10 | - UDP fragmentation [MW] |
11 | * CORE: | 11 | * CORE: |
12 | - Core API's peer_change_preference leaks 'irc' and | 12 | - Core API's notify_transmit_ready leaks 'th'! |
13 | Core API's notify_transmit_ready leaks 'th'! | ||
14 | * FS [CG] | 13 | * FS [CG] |
15 | - download of 100 MB file from 'leach' peer hung due to | 14 | - download of 100 MB file from 'leach' peer hung due to |
16 | failure of core-api to call back after a change preference request | 15 | failure of core-api to call back after a change preference request |
@@ -125,7 +124,6 @@ | |||
125 | - testcase would be nice | 124 | - testcase would be nice |
126 | - generic block support for DHT | 125 | - generic block support for DHT |
127 | * STATISTICS: | 126 | * STATISTICS: |
128 | - test notification-based statistics API | ||
129 | - implement statistics GUI (=> start from gnunet-gtk by button!) | 127 | - implement statistics GUI (=> start from gnunet-gtk by button!) |
130 | * PEERINFO: [NN] | 128 | * PEERINFO: [NN] |
131 | - move peerinfo to new GUI (=> start from gnunet-gtk by button!) | 129 | - 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 | |||
83 | void *pcic_cls; | 83 | void *pcic_cls; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Pointer to free when we call pcic. | ||
87 | */ | ||
88 | void *pcic_ptr; | ||
89 | |||
90 | /** | ||
86 | * Request information ID for the given pcic (needed in case a | 91 | * Request information ID for the given pcic (needed in case a |
87 | * request is cancelled after being submitted to core and a new | 92 | * request is cancelled after being submitted to core and a new |
88 | * one is generated; in this case, we need to avoid matching the | 93 | * one is generated; in this case, we need to avoid matching the |
@@ -419,6 +424,8 @@ disconnect_and_free_peer_entry (void *cls, | |||
419 | if (NULL != (pcic = pr->pcic)) | 424 | if (NULL != (pcic = pr->pcic)) |
420 | { | 425 | { |
421 | pr->pcic = NULL; | 426 | pr->pcic = NULL; |
427 | GNUNET_free_non_null (pr->pcic_ptr); | ||
428 | pr->pcic_ptr = NULL; | ||
422 | pcic (pr->pcic_cls, | 429 | pcic (pr->pcic_cls, |
423 | &pr->peer, | 430 | &pr->peer, |
424 | zero, | 431 | zero, |
@@ -1250,6 +1257,8 @@ main_notify_handler (void *cls, | |||
1250 | } | 1257 | } |
1251 | pcic = pr->pcic; | 1258 | pcic = pr->pcic; |
1252 | pr->pcic = NULL; | 1259 | pr->pcic = NULL; |
1260 | GNUNET_free_non_null (pr->pcic_ptr); | ||
1261 | pr->pcic_ptr = NULL; | ||
1253 | if (pcic != NULL) | 1262 | if (pcic != NULL) |
1254 | pcic (pr->pcic_cls, | 1263 | pcic (pr->pcic_cls, |
1255 | &pr->peer, | 1264 | &pr->peer, |
@@ -1902,7 +1911,6 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
1902 | irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext)); | 1911 | irc = GNUNET_malloc (sizeof (struct GNUNET_CORE_InformationRequestContext)); |
1903 | irc->h = h; | 1912 | irc->h = h; |
1904 | irc->pr = pr; | 1913 | irc->pr = pr; |
1905 | // FIXME: who frees 'irc'? (if not cancelled?) | ||
1906 | cm = GNUNET_malloc (sizeof (struct ControlMessage) + | 1914 | cm = GNUNET_malloc (sizeof (struct ControlMessage) + |
1907 | sizeof (struct RequestInfoMessage)); | 1915 | sizeof (struct RequestInfoMessage)); |
1908 | cm->cont = &change_preference_send_continuation; | 1916 | cm->cont = &change_preference_send_continuation; |
@@ -1925,6 +1933,7 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
1925 | cm); | 1933 | cm); |
1926 | pr->pcic = info; | 1934 | pr->pcic = info; |
1927 | pr->pcic_cls = info_cls; | 1935 | pr->pcic_cls = info_cls; |
1936 | pr->pcic_ptr = irc; /* for free'ing irc */ | ||
1928 | if (h->control_pending_head == cm) | 1937 | if (h->control_pending_head == cm) |
1929 | trigger_next_request (h, GNUNET_NO); | 1938 | trigger_next_request (h, GNUNET_NO); |
1930 | return irc; | 1939 | return irc; |
@@ -1948,6 +1957,7 @@ GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequest | |||
1948 | struct GNUNET_CORE_Handle *h = irc->h; | 1957 | struct GNUNET_CORE_Handle *h = irc->h; |
1949 | struct PeerRecord *pr = irc->pr; | 1958 | struct PeerRecord *pr = irc->pr; |
1950 | 1959 | ||
1960 | GNUNET_assert (pr->pcic_ptr == irc); | ||
1951 | if (irc->cm != NULL) | 1961 | if (irc->cm != NULL) |
1952 | { | 1962 | { |
1953 | GNUNET_CONTAINER_DLL_remove (h->control_pending_head, | 1963 | GNUNET_CONTAINER_DLL_remove (h->control_pending_head, |
@@ -1957,6 +1967,7 @@ GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequest | |||
1957 | } | 1967 | } |
1958 | pr->pcic = NULL; | 1968 | pr->pcic = NULL; |
1959 | pr->pcic_cls = NULL; | 1969 | pr->pcic_cls = NULL; |
1970 | pr->pcic_ptr = NULL; | ||
1960 | GNUNET_free (irc); | 1971 | GNUNET_free (irc); |
1961 | } | 1972 | } |
1962 | 1973 | ||