diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-11-09 17:23:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-11-09 17:23:30 +0000 |
commit | 9d55674c58b63487c67b8539492b4315b561a7f1 (patch) | |
tree | 66cbf469d9b795879d43f5e9c2b7866c2e3e53cc /src/identity | |
parent | 5f05e39051f6339e6908392f0ef212b42a5682fb (diff) | |
download | gnunet-9d55674c58b63487c67b8539492b4315b561a7f1.tar.gz gnunet-9d55674c58b63487c67b8539492b4315b561a7f1.zip |
-fix potential leak and awkward test behavior causing it
Diffstat (limited to 'src/identity')
-rw-r--r-- | src/identity/identity_api.c | 15 | ||||
-rw-r--r-- | src/identity/test_identity_defaults.c | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 931deb509..38c9efdd4 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -952,13 +952,6 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) | |||
952 | struct GNUNET_IDENTITY_Operation *op; | 952 | struct GNUNET_IDENTITY_Operation *op; |
953 | 953 | ||
954 | GNUNET_assert (NULL != h); | 954 | GNUNET_assert (NULL != h); |
955 | while (NULL != (op = h->op_head)) | ||
956 | { | ||
957 | GNUNET_CONTAINER_DLL_remove (h->op_head, | ||
958 | h->op_tail, | ||
959 | op); | ||
960 | GNUNET_free (op); | ||
961 | } | ||
962 | if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) | 955 | if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) |
963 | { | 956 | { |
964 | GNUNET_SCHEDULER_cancel (h->reconnect_task); | 957 | GNUNET_SCHEDULER_cancel (h->reconnect_task); |
@@ -977,6 +970,14 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) | |||
977 | GNUNET_CONTAINER_multihashmap_destroy (h->egos); | 970 | GNUNET_CONTAINER_multihashmap_destroy (h->egos); |
978 | h->egos = NULL; | 971 | h->egos = NULL; |
979 | } | 972 | } |
973 | GNUNET_break (NULL == h->op_head); | ||
974 | while (NULL != (op = h->op_head)) | ||
975 | { | ||
976 | GNUNET_CONTAINER_DLL_remove (h->op_head, | ||
977 | h->op_tail, | ||
978 | op); | ||
979 | GNUNET_free (op); | ||
980 | } | ||
980 | if (NULL != h->client) | 981 | if (NULL != h->client) |
981 | { | 982 | { |
982 | GNUNET_CLIENT_disconnect (h->client); | 983 | GNUNET_CLIENT_disconnect (h->client); |
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c index f525bb6c7..980f4abd2 100644 --- a/src/identity/test_identity_defaults.c +++ b/src/identity/test_identity_defaults.c | |||
@@ -213,6 +213,8 @@ notification_cb (void *cls, | |||
213 | { | 213 | { |
214 | if (NULL == ego) | 214 | if (NULL == ego) |
215 | return; /* skip first call */ | 215 | return; /* skip first call */ |
216 | if (NULL == identifier) | ||
217 | return; /* deletion / shutdown */ | ||
216 | op = GNUNET_IDENTITY_set (h, | 218 | op = GNUNET_IDENTITY_set (h, |
217 | "test-service", | 219 | "test-service", |
218 | ego, | 220 | ego, |