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) |
- 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 ef04ea2593..838c967fc2 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c @@ -755,6 +755,16 @@ static void tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p); /** + * Tunnel is empty: destroy it. + * + * Notifies all participants (peers, cleints) about the destruction. + * + * @param t Tunnel to destroy. + */ +static void +tunnel_destroy_empty (struct MeshTunnel *t); + +/** * @brief Queue and pass message to core when possible. * * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status @@ -1285,6 +1295,7 @@ peer_info_destroy (struct MeshPeerInfo *pi) struct GNUNET_PeerIdentity id; struct MeshPeerPath *p; struct MeshPeerPath *nextp; + unsigned int i; GNUNET_PEER_resolve (pi->id, &id); GNUNET_PEER_change_rc (pi->id, -1); @@ -1308,6 +1319,9 @@ peer_info_destroy (struct MeshPeerInfo *pi) path_destroy (p); p = nextp; } + for (i = 0; i < pi->ntunnels; i++) + tunnel_destroy_empty (pi->tunnels[i]); + GNUNET_array_grow (pi->tunnels, pi->ntunnels, 0); GNUNET_free (pi); return GNUNET_OK; } |