gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17848 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r17848 - gnunet/src/mesh
Date: Fri, 28 Oct 2011 18:41:02 +0200

Author: bartpolot
Date: 2011-10-28 18:41:02 +0200 (Fri, 28 Oct 2011)
New Revision: 17848

Modified:
   gnunet/src/mesh/mesh_tunnel_tree.c
Log:
Fixed a memory leak


Modified: gnunet/src/mesh/mesh_tunnel_tree.c
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.c  2011-10-28 16:00:54 UTC (rev 17847)
+++ gnunet/src/mesh/mesh_tunnel_tree.c  2011-10-28 16:41:02 UTC (rev 17848)
@@ -403,14 +403,17 @@
     hop = π
     GNUNET_PEER_resolve(old->peer, hop);
   }
-  copy = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
+  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_PEER_resolve(parent->peer, &id);
+
   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)
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]