aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/set/gnunet-service-set.c5
-rw-r--r--src/set/gnunet-service-set_union.c31
2 files changed, 34 insertions, 2 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 3ed896775..9ac0fbee6 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -324,7 +324,7 @@ handle_client_create (void *cls,
324 return; 324 return;
325 } 325 }
326 326
327 set = GNUNET_new (struct Set); 327 set = NULL;
328 328
329 switch (ntohs (msg->operation)) 329 switch (ntohs (msg->operation))
330 { 330 {
@@ -336,12 +336,13 @@ handle_client_create (void *cls,
336 set = _GSS_union_set_create (); 336 set = _GSS_union_set_create ();
337 break; 337 break;
338 default: 338 default:
339 GNUNET_free (set);
340 GNUNET_break (0); 339 GNUNET_break (0);
341 GNUNET_SERVER_client_disconnect (client); 340 GNUNET_SERVER_client_disconnect (client);
342 return; 341 return;
343 } 342 }
344 343
344 GNUNET_assert (NULL != set);
345
345 set->client = client; 346 set->client = client;
346 GNUNET_SERVER_client_keep (client); 347 GNUNET_SERVER_client_keep (client);
347 set->client_mq = GNUNET_MQ_queue_for_server_client (client); 348 set->client_mq = GNUNET_MQ_queue_for_server_client (client);
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 694fb6056..05b125047 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -364,6 +364,34 @@ destroy_elements (struct UnionState *us)
364} 364}
365 365
366 366
367
368/**
369 * Iterator over hash map entries.
370 *
371 * @param cls closure
372 * @param key current key code
373 * @param value value in the hash map
374 * @return GNUNET_YES if we should continue to
375 * iterate,
376 * GNUNET_NO if not.
377 */
378static int
379destroy_key_to_element_iter (void *cls,
380 uint32_t key,
381 void *value)
382{
383 struct KeyEntry *k = value;
384
385 while (NULL != k)
386 {
387 struct KeyEntry *k_tmp = k;
388 k = k->next_colliding;
389 GNUNET_free (k_tmp);
390 }
391 return GNUNET_YES;
392}
393
394
367/** 395/**
368 * Destroy a union operation, and free all resources 396 * Destroy a union operation, and free all resources
369 * associated with it. 397 * associated with it.
@@ -400,6 +428,7 @@ destroy_union_operation (struct UnionEvaluateOperation *eo)
400 } 428 }
401 if (NULL != eo->key_to_element) 429 if (NULL != eo->key_to_element)
402 { 430 {
431 GNUNET_CONTAINER_multihashmap32_iterate (eo->key_to_element, destroy_key_to_element_iter, NULL);
403 GNUNET_CONTAINER_multihashmap32_destroy (eo->key_to_element); 432 GNUNET_CONTAINER_multihashmap32_destroy (eo->key_to_element);
404 eo->key_to_element = NULL; 433 eo->key_to_element = NULL;
405 } 434 }
@@ -1030,6 +1059,8 @@ handle_p2p_elements (void *cls, const struct GNUNET_MessageHeader *mh)
1030 1059
1031 insert_element (eo, ee); 1060 insert_element (eo, ee);
1032 send_client_element (eo, &ee->element); 1061 send_client_element (eo, &ee->element);
1062
1063 GNUNET_free (ee);
1033} 1064}
1034 1065
1035 1066