aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-10-05 11:29:50 +0000
committerChristian Grothoff <christian@grothoff.org>2014-10-05 11:29:50 +0000
commitc26fb31c8747566e558715e17e95c3ae45831a22 (patch)
tree67be2251b986f2d33582b67b947cd2f6eaa0cfeb /src/dht
parent632a39e7a6ce4f4f71901ae50c4dd010066c20f3 (diff)
downloadgnunet-c26fb31c8747566e558715e17e95c3ae45831a22.tar.gz
gnunet-c26fb31c8747566e558715e17e95c3ae45831a22.zip
-avoid leaking trail by avoiding allocation in the first place, use unsigned as appropriate, eliminate useless return
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index e8e9e8df9..d7d2f6c38 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -3137,7 +3137,7 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity,
3137 struct FingerInfo *new_entry; 3137 struct FingerInfo *new_entry;
3138 struct FriendInfo *first_trail_hop; 3138 struct FriendInfo *first_trail_hop;
3139 struct Trail *trail; 3139 struct Trail *trail;
3140 int i; 3140 unsigned int i;
3141 3141
3142 new_entry = GNUNET_new (struct FingerInfo); 3142 new_entry = GNUNET_new (struct FingerInfo);
3143 new_entry->finger_identity = finger_identity; 3143 new_entry->finger_identity = finger_identity;
@@ -3181,7 +3181,7 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity,
3181 new_entry->trails_count = 1; 3181 new_entry->trails_count = 1;
3182 first_trail_hop->trails_count++; 3182 first_trail_hop->trails_count++;
3183 /* Copy the finger trail into trail. */ 3183 /* Copy the finger trail into trail. */
3184 trail = GNUNET_new (struct Trail); 3184 trail = &new_entry->trail_list[0];
3185 for(i = 0; i < finger_trail_length; i++) 3185 for(i = 0; i < finger_trail_length; i++)
3186 { 3186 {
3187 struct Trail_Element *element = GNUNET_new (struct Trail_Element); 3187 struct Trail_Element *element = GNUNET_new (struct Trail_Element);
@@ -3195,14 +3195,11 @@ add_new_finger (struct GNUNET_PeerIdentity finger_identity,
3195 } 3195 }
3196 3196
3197 /* Add trail to trail list. */ 3197 /* Add trail to trail list. */
3198 new_entry->trail_list[0].trail_head = trail->trail_head; 3198 trail->trail_length = finger_trail_length;
3199 new_entry->trail_list[0].trail_tail = trail->trail_tail; 3199 trail->trail_id = trail_id;
3200 new_entry->trail_list[0].trail_length = finger_trail_length; 3200 trail->is_present = GNUNET_YES;
3201 new_entry->trail_list[0].trail_id = trail_id;
3202 new_entry->trail_list[0].is_present = GNUNET_YES;
3203 finger_table[finger_table_index] = *new_entry; 3201 finger_table[finger_table_index] = *new_entry;
3204 GNUNET_free (new_entry); 3202 GNUNET_free (new_entry);
3205 return;
3206} 3203}
3207 3204
3208 3205