From eed7f472501226b6d6c4f32d3c88d14123f74236 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 15 Sep 2013 10:07:03 +0000 Subject: -properly clean up on disconnect, without memory leaks --- src/identity/identity_api.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/identity/identity_api.c') diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 1530aff39..a6d15ae38 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -879,9 +879,8 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, * the operation. * * @param op operation to cancel - * @return GNUNET_YES if the continuation was cancelled */ -int +void GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) { struct GNUNET_IDENTITY_Handle *h = op->h; @@ -894,7 +893,7 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) h->op_tail, op); GNUNET_free (op); - return GNUNET_YES; + return; } if (NULL != h->th) { @@ -906,12 +905,11 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) op); GNUNET_free (op); transmit_next (h); - return GNUNET_YES; + return; } /* request active with service, simply ensure continuations are not called */ op->cont = NULL; op->cb = NULL; - return GNUNET_NO; } @@ -955,8 +953,14 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) GNUNET_assert (NULL != h); while (NULL != (op = h->op_head)) - if (GNUNET_YES != GNUNET_IDENTITY_cancel (op)) - break; + { + if (NULL != h->th) + GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); + GNUNET_CONTAINER_DLL_remove (h->op_head, + h->op_tail, + op); + GNUNET_free (op); + } if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (h->reconnect_task); -- cgit v1.2.3