summaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-28 16:41:02 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-28 16:41:02 +0000
commit53edf5e34cbe0b24fa448770fa07c7580d2bfbff (patch)
treeafe33de83747f0ddbe862c77f396503bfd7e6c82 /src/mesh
parent184e8fa34b2ed62edb3459462ba6fde2018eaf1a (diff)
Fixed a memory leak
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/mesh_tunnel_tree.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index c58260601..a01ff2ca7 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -403,14 +403,17 @@ tree_update_first_hops (struct MeshTunnelTree *tree,
hop = &pi;
GNUNET_PEER_resolve(old->peer, hop);
}
- copy = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
- *copy = *hop;
GNUNET_PEER_resolve(parent->peer, &id);
+ copy = GNUNET_CONTAINER_multihashmap_get (tree->first_hops, &id.hashPubKey);
+ if (NULL == copy)
+ copy = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
+ *copy = *hop;
+
GNUNET_CONTAINER_multihashmap_put(
tree->first_hops,
&id.hashPubKey,
copy,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
for (n = parent->children_head; NULL != n; n = n->next)
{