[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34339 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34339 - gnunet/src/dht |
Date: |
Sun, 5 Oct 2014 13:29:50 +0200 |
Author: grothoff
Date: 2014-10-05 13:29:50 +0200 (Sun, 05 Oct 2014)
New Revision: 34339
Modified:
gnunet/src/dht/gnunet-service-xdht_neighbours.c
Log:
-avoid leaking trail by avoiding allocation in the first place, use unsigned as
appropriate, eliminate useless return
Modified: gnunet/src/dht/gnunet-service-xdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-10-05 11:26:25 UTC
(rev 34338)
+++ gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-10-05 11:29:50 UTC
(rev 34339)
@@ -3137,7 +3137,7 @@
struct FingerInfo *new_entry;
struct FriendInfo *first_trail_hop;
struct Trail *trail;
- int i;
+ unsigned int i;
new_entry = GNUNET_new (struct FingerInfo);
new_entry->finger_identity = finger_identity;
@@ -3181,7 +3181,7 @@
new_entry->trails_count = 1;
first_trail_hop->trails_count++;
/* Copy the finger trail into trail. */
- trail = GNUNET_new (struct Trail);
+ trail = &new_entry->trail_list[0];
for(i = 0; i < finger_trail_length; i++)
{
struct Trail_Element *element = GNUNET_new (struct Trail_Element);
@@ -3195,14 +3195,11 @@
}
/* Add trail to trail list. */
- new_entry->trail_list[0].trail_head = trail->trail_head;
- new_entry->trail_list[0].trail_tail = trail->trail_tail;
- new_entry->trail_list[0].trail_length = finger_trail_length;
- new_entry->trail_list[0].trail_id = trail_id;
- new_entry->trail_list[0].is_present = GNUNET_YES;
+ trail->trail_length = finger_trail_length;
+ trail->trail_id = trail_id;
+ trail->is_present = GNUNET_YES;
finger_table[finger_table_index] = *new_entry;
GNUNET_free (new_entry);
- return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34339 - gnunet/src/dht,
gnunet <=