aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2006-04-23 02:04:58 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2006-04-23 02:04:58 +0000
commit54ffdb125c287b527a97b05f83bd942249a91446 (patch)
tree56765ca4fae2a288923031b5cf63053bc3ecf2ab /libgfortran/io/unix.c
parente8bbccd6439e18fa693a7bee5e659dcd20f4c80f (diff)
downloadgcc-54ffdb125c287b527a97b05f83bd942249a91446.zip
gcc-54ffdb125c287b527a97b05f83bd942249a91446.tar.gz
gcc-54ffdb125c287b527a97b05f83bd942249a91446.tar.bz2
re PR libfortran/20257 (Fortran runtime error: End of record occurs when writing large arrays)
2006-04-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/20257 * io/io.h: Add prototypes for get_internal_unit and free_internal_unit. * io/unit.c (get_internal_unit): Initialize unit number, not zero. (free_internal_unit): New function to consolidate freeing memory. (get_unit): Initialize internal_unit_desc to NULL when unit is external. * io/unix.c (mem_close): Check for not NULL before freeing memory. * io/transfer.c (read_block): Reset bytes_left and skip error if unit is preconnected and default record length is reached. (read_block_direct): Ditto. (write_block): Ditto. (write_buf): Ditto. (data_transfer_init): Only flush if not internal unit. (finalize_transfer): Ditto and delete code to free memory used by internal units. (st_read_done): Use new function - free_internal_unit. (st_write_done): Use new function - free_internal unit. From-SVN: r113190
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 550ddab..93f4ea6 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -928,7 +928,8 @@ mem_truncate (unix_stream * s __attribute__ ((unused)))
static try
mem_close (unix_stream * s)
{
- free_mem (s);
+ if (s != NULL)
+ free_mem (s);
return SUCCESS;
}