From: pault Date: Mon, 18 Apr 2005 22:19:27 +0000 (+0000) Subject: correct memory leaks in namelist code for derived types X-Git-Tag: upstream/4.9.2~61981 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4516dace8ad4d5efb44153a9bfe54a8e17bf5858;p=platform%2Fupstream%2Flinaro-gcc.git correct memory leaks in namelist code for derived types git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98352 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f4716af..d0dc7f1 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2005-04-18 Paul Thomas + + * io/list_read.c (nml_touch_nodes, nml_read_obj, + nml_get_obj_data): Fix memory leaks in code for derived types. + 2005-04-11 Francois-Xavier Coudert PR libfortran/20950 @@ -16,11 +21,11 @@ 2005-04-17 Paul Thomas -* io/list_read.c (eat_separator): at_eol = 1 replaced(zapped at some time?). + * io/list_read.c (eat_separator): at_eol = 1 replaced + (zapped at some time?). 2005-04-17 Paul Thomas - PR libgfortran/12884 PR libgfortran/17285 PR libgfortran/18122 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index becf09e..bc592dd 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1673,6 +1673,7 @@ nml_touch_nodes (namelist_info * nl) else break; } + free_mem (ext_name); return; } @@ -1914,10 +1915,16 @@ nml_read_obj (namelist_info * nl, index_type offset) { if (nml_read_obj (cmp, (index_type)(pdata - nl->mem_pos)) == FAILURE) - return FAILURE; + { + free_mem (obj_name); + return FAILURE; + } if (input_complete) - return SUCCESS; + { + free_mem (obj_name); + return SUCCESS; + } } free_mem (obj_name); @@ -2105,6 +2112,7 @@ get_name: strcpy (ext_name, root_nl->var_name); strcat (ext_name, saved_string); nl = find_nml_node (ext_name); + free_mem (ext_name); } else nl = find_nml_node (saved_string);