From 4e72e1c5a2cdef4e9b123cfa544e7fe78c92eda2 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sun, 30 Apr 2006 03:19:37 +0000 Subject: [PATCH] re PR libfortran/27360 (Memory leaks when reading logicals) 2006-04-29 Jerry DeLisle PR libgfortran/27360 * io/list_read.c (read_logical): Free line_buffer and free saved. From-SVN: r113388 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/list_read.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c8ecbfcc07e..90537156703 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2006-04-29 Jerry DeLisle + + PR libgfortran/27360 + + * io/list_read.c (read_logical): Free line_buffer and free saved. + 2006-04-28 Jerry DeLisle PR libgfortran/27304 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 0d1969b5348..ab3965d5f58 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -652,6 +652,7 @@ read_logical (st_parameter_dt *dtp, int length) dtp->u.p.item_count = 0; dtp->u.p.line_buffer_enabled = 0; set_integer ((int *) dtp->u.p.value, v, length); + free_line (dtp); return; @@ -689,25 +690,27 @@ read_logical (st_parameter_dt *dtp, int length) bad_logical: + free_line (dtp); + if (nml_bad_return (dtp, c)) return; eat_line (dtp); free_saved (dtp); - if (dtp->u.p.line_buffer != NULL) - free_mem (dtp->u.p.line_buffer); st_sprintf (message, "Bad logical value while reading item %d", dtp->u.p.item_count); generate_error (&dtp->common, ERROR_READ_VALUE, message); return; logical_done: - + dtp->u.p.item_count = 0; dtp->u.p.line_buffer_enabled = 0; dtp->u.p.saved_type = BT_LOGICAL; dtp->u.p.saved_length = length; set_integer ((int *) dtp->u.p.value, v, length); + free_saved (dtp); + free_line (dtp); }