Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fixed a few memleak
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 7 Jan 2005 20:32:07 +0000 (20:32 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 7 Jan 2005 20:32:07 +0000 (20:32 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@743 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/surf.c
src/surf/surf_parse.c

index 171b66a..f1206eb 100644 (file)
@@ -148,12 +148,12 @@ void surf_init(int *argc, char **argv)
     maxmin_system = lmm_system_new();
 }
 
+static char* path_name = NULL;
 FILE *surf_fopen(const char *name, const char *mode)
 {
   int i; 
   char* path = NULL;
   FILE *file = NULL;
-  static char* path_name = NULL;
 
   xbt_assert0(surf_path,"surf_init has to be called before using surf_fopen");
   if(!path_name) path_name=xbt_new0(char,strlen(name)+1);
@@ -190,8 +190,15 @@ void surf_finalize(void)
   if (resource_list)
     xbt_dynar_free(&resource_list);
 
+  if(surf_path) 
+    xbt_dynar_free(&surf_path);
+
   tmgr_finalize();
   surf_parse_lex_destroy();
+  if(path_name) {
+    xbt_free(path_name);
+    path_name = NULL;
+  }
 }
 
 double surf_solve(void)
index 02d8c0f..2261a1c 100644 (file)
@@ -162,6 +162,11 @@ void  surf_parse_open(const char *file) {
 }
 
 void  surf_parse_close(void) {
+  if(surf_input_buffer_stack) 
+    xbt_dynar_free(&surf_input_buffer_stack);
+  if(surf_file_to_parse_stack) 
+    xbt_dynar_free(&surf_file_to_parse_stack);
+
   surf_parse__delete_buffer(surf_input_buffer);
   fclose(surf_file_to_parse);
 }