2015-04-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
commit7502b19d938bde2fcfc9d5976e82003349dce04f
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Apr 2015 01:27:03 +0000 (15 01:27 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Apr 2015 01:27:03 +0000 (15 01:27 +0000)
tree069058137168dad71c78507962553db85245d69c
parent01f8008f681cce2efc5a5cd3eddb5ee0bab46eb1
2015-04-14 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/65089
* io/format.h (free_format): New function to free memory
allocated for building format error messages.
* io/format.c (format_error): Add checks before freeing memory
to avoid potential segfaults and free formatting data when
needed on error conditions. Always allocate and NULL terminate
the string.
* io/transfer.c (st_read_done, st_write_done): Use new
free_format function to clean up memory allocations when done.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222111 138bc75d-0d04-0410-961f-82ee72b054a4
libgfortran/ChangeLog
libgfortran/io/format.c
libgfortran/io/format.h
libgfortran/io/transfer.c