From: Bart Polot Date: Fri, 28 Oct 2011 16:41:02 +0000 (+0000) Subject: Fixed a memory leak X-Git-Tag: initial-import-from-subversion-38251~16164 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=53edf5e34cbe0b24fa448770fa07c7580d2bfbff;p=oweals%2Fgnunet.git Fixed a memory leak --- 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 = π 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) {