Cleanup edges stored in edge_weight_tree on exit
authorthorkill <thkr@hannover.ccc.de>
Sat, 4 Jul 2015 00:39:12 +0000 (02:39 +0200)
committerthorkill <thkr@hannover.ccc.de>
Sat, 4 Jul 2015 01:24:05 +0000 (03:24 +0200)
protocol_edge.c: 131 defines local_address using str2sockaddr

str2sockaddr() allocates memory which has to be freed on exit.

src/edge.c

index 2eaae5d..6539630 100644 (file)
@@ -64,6 +64,12 @@ void free_edge_tree(splay_tree_t *edge_tree) {
 }
 
 void exit_edges(void) {
+       // since edge_weight_tree does not have delete action defined
+       // we have to cleanup it on exit
+       for splay_each(edge_t, e, edge_weight_tree) {
+                       sockaddrfree(&e->address);
+                       sockaddrfree(&e->local_address);
+               }
        splay_delete_tree(edge_weight_tree);
 }