diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f361408a5039..aafa660ccf51 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-10-07 Paul Brook + + * io/transfer.c (finalize_transfer): Free internal streams. + * io/unix.c (mem_close): Free stream object. + 2004-10-07 Paul Brook * intrinsics/string_intrinsics.c (string_verify): Fix off by one diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 70a41fcff835..ceff76fc35c5 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1349,7 +1349,8 @@ next_record (int done) /* Finalize the current data transfer. For a nonadvancing transfer, - this means advancing to the next record. */ + this means advancing to the next record. For internal units close the + steam associated with the unit. */ static void finalize_transfer (void) @@ -1392,6 +1393,9 @@ finalize_transfer (void) } sfree (current_unit->s); + + if (is_internal_unit ()) + sclose (current_unit->s); } diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index e55966b2f2a3..c8b18fc96fc6 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -811,6 +811,7 @@ mem_truncate (unix_stream * s) static try mem_close (unix_stream * s) { + free_mem (s); return SUCCESS; }