From: Martin Quinson Date: Tue, 15 Nov 2011 12:14:28 +0000 (+0100) Subject: plug a bunch of memleaks X-Git-Tag: exp_20120216~266 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f96c4337f949604e5d4e4b30f3ff6418ddf831ee plug a bunch of memleaks --- diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index a507e10547..3a5f19f20c 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -251,6 +251,7 @@ static void routing_parse_E_route(void) "no defined method \"set_route\" in \"%s\"", current_routing->name); current_routing->parse_route(current_routing, src, dst, route); + generic_free_route(route); parsed_link_list = NULL; src = NULL; dst = NULL; @@ -269,6 +270,7 @@ static void routing_parse_E_ASroute(void) "no defined method \"set_ASroute\" in \"%s\"", current_routing->name); current_routing->parse_ASroute(current_routing, src, dst, e_route); + generic_free_route(e_route); parsed_link_list = NULL; src = NULL; dst = NULL; diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index a4e1fa3609..be0e83e33c 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -152,8 +152,8 @@ static void floyd_finalize(AS_t rc) xbt_dict_free(&(as->generic_routing.to_index)); /* Delete dictionary index dict, predecessor and links table */ xbt_free(as->predecessor_table); - /* Delete structure */ - xbt_free(rc); + + model_generic_finalize(rc); } } diff --git a/src/surf/surf_routing_full.c b/src/surf/surf_routing_full.c index 60dff10a57..3263bb8e70 100644 --- a/src/surf/surf_routing_full.c +++ b/src/surf/surf_routing_full.c @@ -251,6 +251,4 @@ void model_full_set_route(AS_t rc, const char *src, xbt_dynar_shrink(TO_ROUTE_FULL(*dst_id, *src_id)->link_list, 0); } } - - generic_free_route((route_t)route) ; } diff --git a/src/surf/surf_routing_rulebased.c b/src/surf/surf_routing_rulebased.c index 9b7c4200fe..b9fb8c4c6e 100644 --- a/src/surf/surf_routing_rulebased.c +++ b/src/surf/surf_routing_rulebased.c @@ -100,9 +100,11 @@ static void model_rulebased_parse_route(AS_t rc, xbt_assert(ruleroute->re_src, "PCRE compilation failed at offset %d (\"%s\"): %s\n", erroffset, dst, error); + ruleroute->re_str_link = route->link_list; + route->link_list = NULL; // Don't free it twice in each container + xbt_dynar_push(routing->list_route, &ruleroute); - xbt_free(route); } static void model_rulebased_parse_ASroute(AS_t rc, @@ -134,9 +136,10 @@ static void model_rulebased_parse_ASroute(AS_t rc, ruleroute_e->re_src_gateway = route->src_gateway; ruleroute_e->re_dst_gateway = route->dst_gateway; xbt_dynar_push(routing->list_ASroute, &ruleroute_e); -// xbt_free(route->src_gateway); -// xbt_free(route->dst_gateway); - xbt_free(route); + + /* make sure that they don't get freed */ + route->link_list = NULL; + route->src_gateway = route->dst_gateway = NULL; } static void model_rulebased_parse_bypassroute(AS_t rc, @@ -373,8 +376,8 @@ static void rulebased_finalize(AS_t rc) xbt_dict_free(&routing->dict_autonomous_systems); xbt_dynar_free(&routing->list_route); xbt_dynar_free(&routing->list_ASroute); - /* Delete structure */ - xbt_free(routing); + + model_generic_finalize(rc); } }