Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
pre version hierarchical routing, fix memory leak
[simgrid.git] / src / surf / surf_routing.c
index a9e42cc..07421a7 100644 (file)
@@ -232,7 +232,7 @@ static void parse_S_AS(void) {
     for (cpt=0;routing_models[cpt].name;cpt++)
       if (!strcmp(wanted,routing_models[cpt].name))
         fprintf(stderr,"   %s: %s\n",routing_models[cpt].name,routing_models[cpt].desc);
-    exit(1);
+    xbt_die(NULL);
   }
 
   /* make a new routing component */
@@ -408,11 +408,6 @@ static xbt_dynar_t elements_father(const char* src,const char* dst) {
 
 /* Global Business methods */
 
-// typedef enum {
-//   SURF_LOCAL_SOLVE = 0,   /**< No Local solve */ 
-//   SURF_NO_LOCAL_SOLVE,       /**< Local solve */
-// } e_surf_is_local_t;
-
 static route_extended_t _get_route(const char* src,const char* dst) {
   
   void* link;
@@ -442,6 +437,8 @@ static route_extended_t _get_route(const char* src,const char* dst) {
       xbt_dynar_foreach(e_route_cnt->generic_route.link_list, cpt, link) {
         xbt_dynar_push(e_route->generic_route.link_list,&link);
       }
+      xbt_dynar_free( &(e_route_cnt->generic_route.link_list) );
+      xbt_free(e_route_cnt);
     }
     
   } else { /* SURF_ROUTING_RECURSIVE */
@@ -479,6 +476,9 @@ static route_extended_t _get_route(const char* src,const char* dst) {
       xbt_dynar_free( &(e_route_dst->generic_route.link_list) );
       xbt_free(e_route_dst);
   }
+  
+  xbt_dynar_free(&elem_father_list);
+  
   return e_route; 
 }
 
@@ -508,6 +508,7 @@ static xbt_dynar_t get_route(const char* src,const char* dst) {
   global_routing->last_route = e_route->generic_route.link_list;
  
   xbt_free(e_route);
+  xbt_dynar_free(&elem_father_list);
   
   if( xbt_dynar_length(global_routing->last_route)==0 )
     return NULL;