From: alegrand Date: Fri, 7 Jan 2005 20:32:07 +0000 (+0000) Subject: fixed a few memleak X-Git-Tag: v3.3~4607 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a6b41eb21f97a92944773d9eeedc50e96dc3ec53 fixed a few memleak git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@743 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/surf/surf.c b/src/surf/surf.c index 171b66a48a..f1206eb9ab 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -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) diff --git a/src/surf/surf_parse.c b/src/surf/surf_parse.c index 02d8c0f8dd..2261a1c986 100644 --- a/src/surf/surf_parse.c +++ b/src/surf/surf_parse.c @@ -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); }