X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b6e0974be6616f62aa724f7ec7ad1cff1b421e1e..be4b540460e5f67714677c3ecf9ff54d2916f0d8:/src/surf/surf_routing.cpp diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 568d33f9b9..6216697e01 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -397,7 +397,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) info->p_rcComponent = new_as->p_routingFather; info->p_rcType = SURF_NETWORK_ELEMENT_AS; - info->p_name = new_as->p_name; + info->p_name = xbt_strdup(new_as->p_name); xbt_lib_set(as_router_lib, info->p_name, ROUTING_ASR_LEVEL, (void *) info); @@ -1263,11 +1263,13 @@ static void finalize_rec(AsPtr as) { /** \brief Frees all memory allocated by the routing module */ void routing_exit(void) { - if (!routing_platf) - return; - xbt_dynar_free(&routing_platf->p_lastRoute); - finalize_rec(routing_platf->p_root); - xbt_free(routing_platf); + delete routing_platf; +} + +RoutingPlatf::~RoutingPlatf() +{ + xbt_dynar_free(&p_lastRoute); + finalize_rec(p_root); } AS_t surf_AS_get_routing_root() {