diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-15 10:07:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-15 10:07:03 +0000 |
commit | eed7f472501226b6d6c4f32d3c88d14123f74236 (patch) | |
tree | 50051b7f67d59b83ae26fe905de1709fce3ceddb /src/identity/identity_api.c | |
parent | 5aade75659784566c4f8e3b554d98da3dfd09fd2 (diff) | |
download | gnunet-eed7f472501226b6d6c4f32d3c88d14123f74236.tar.gz gnunet-eed7f472501226b6d6c4f32d3c88d14123f74236.zip |
-properly clean up on disconnect, without memory leaks
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r-- | src/identity/identity_api.c | 18 |
1 files changed, 11 insertions, 7 deletions
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, | |||
879 | * the operation. | 879 | * the operation. |
880 | * | 880 | * |
881 | * @param op operation to cancel | 881 | * @param op operation to cancel |
882 | * @return GNUNET_YES if the continuation was cancelled | ||
883 | */ | 882 | */ |
884 | int | 883 | void |
885 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) | 884 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) |
886 | { | 885 | { |
887 | struct GNUNET_IDENTITY_Handle *h = op->h; | 886 | struct GNUNET_IDENTITY_Handle *h = op->h; |
@@ -894,7 +893,7 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) | |||
894 | h->op_tail, | 893 | h->op_tail, |
895 | op); | 894 | op); |
896 | GNUNET_free (op); | 895 | GNUNET_free (op); |
897 | return GNUNET_YES; | 896 | return; |
898 | } | 897 | } |
899 | if (NULL != h->th) | 898 | if (NULL != h->th) |
900 | { | 899 | { |
@@ -906,12 +905,11 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) | |||
906 | op); | 905 | op); |
907 | GNUNET_free (op); | 906 | GNUNET_free (op); |
908 | transmit_next (h); | 907 | transmit_next (h); |
909 | return GNUNET_YES; | 908 | return; |
910 | } | 909 | } |
911 | /* request active with service, simply ensure continuations are not called */ | 910 | /* request active with service, simply ensure continuations are not called */ |
912 | op->cont = NULL; | 911 | op->cont = NULL; |
913 | op->cb = NULL; | 912 | op->cb = NULL; |
914 | return GNUNET_NO; | ||
915 | } | 913 | } |
916 | 914 | ||
917 | 915 | ||
@@ -955,8 +953,14 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) | |||
955 | 953 | ||
956 | GNUNET_assert (NULL != h); | 954 | GNUNET_assert (NULL != h); |
957 | while (NULL != (op = h->op_head)) | 955 | while (NULL != (op = h->op_head)) |
958 | if (GNUNET_YES != GNUNET_IDENTITY_cancel (op)) | 956 | { |
959 | break; | 957 | if (NULL != h->th) |
958 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); | ||
959 | GNUNET_CONTAINER_DLL_remove (h->op_head, | ||
960 | h->op_tail, | ||
961 | op); | ||
962 | GNUNET_free (op); | ||
963 | } | ||
960 | if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) | 964 | if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) |
961 | { | 965 | { |
962 | GNUNET_SCHEDULER_cancel (h->reconnect_task); | 966 | GNUNET_SCHEDULER_cancel (h->reconnect_task); |