diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-06-25 11:08:10 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-06-25 11:08:10 +0000 |
commit | 3f3cc4d7736dd7130e539d8e103d23095e5a214a (patch) | |
tree | ce7ce93914ffddf83320fce8d2d33811cf64ff7d /src | |
parent | abbba0500a7116ebaa5401d3997ccbbc79dc94ff (diff) | |
download | gnunet-3f3cc4d7736dd7130e539d8e103d23095e5a214a.tar.gz gnunet-3f3cc4d7736dd7130e539d8e103d23095e5a214a.zip |
- fix memleak
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-new.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index ef04ea259..838c967fc 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c | |||
@@ -755,6 +755,16 @@ static void | |||
755 | tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p); | 755 | tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p); |
756 | 756 | ||
757 | /** | 757 | /** |
758 | * Tunnel is empty: destroy it. | ||
759 | * | ||
760 | * Notifies all participants (peers, cleints) about the destruction. | ||
761 | * | ||
762 | * @param t Tunnel to destroy. | ||
763 | */ | ||
764 | static void | ||
765 | tunnel_destroy_empty (struct MeshTunnel *t); | ||
766 | |||
767 | /** | ||
758 | * @brief Queue and pass message to core when possible. | 768 | * @brief Queue and pass message to core when possible. |
759 | * | 769 | * |
760 | * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status | 770 | * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status |
@@ -1285,6 +1295,7 @@ peer_info_destroy (struct MeshPeerInfo *pi) | |||
1285 | struct GNUNET_PeerIdentity id; | 1295 | struct GNUNET_PeerIdentity id; |
1286 | struct MeshPeerPath *p; | 1296 | struct MeshPeerPath *p; |
1287 | struct MeshPeerPath *nextp; | 1297 | struct MeshPeerPath *nextp; |
1298 | unsigned int i; | ||
1288 | 1299 | ||
1289 | GNUNET_PEER_resolve (pi->id, &id); | 1300 | GNUNET_PEER_resolve (pi->id, &id); |
1290 | GNUNET_PEER_change_rc (pi->id, -1); | 1301 | GNUNET_PEER_change_rc (pi->id, -1); |
@@ -1308,6 +1319,9 @@ peer_info_destroy (struct MeshPeerInfo *pi) | |||
1308 | path_destroy (p); | 1319 | path_destroy (p); |
1309 | p = nextp; | 1320 | p = nextp; |
1310 | } | 1321 | } |
1322 | for (i = 0; i < pi->ntunnels; i++) | ||
1323 | tunnel_destroy_empty (pi->tunnels[i]); | ||
1324 | GNUNET_array_grow (pi->tunnels, pi->ntunnels, 0); | ||
1311 | GNUNET_free (pi); | 1325 | GNUNET_free (pi); |
1312 | return GNUNET_OK; | 1326 | return GNUNET_OK; |
1313 | } | 1327 | } |