This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran, committed] Fix uninitialized variable in io/read.c


I committed this fix, which removes an access to an uninitialized variable.
While this is not 'obvious' in the literal sense, I double checked that the
variable buffer will be uninitialized on all codepaths which reach this call
to free_mem, and also that there's no memory to be freed along these paths.
Additionally I verified that buffer will be initialized on the path leading to
the other call to free_mem.

Built & tested on i686-pc-linux-gnu.

- Tobi

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/ChangeLog,v
retrieving revision 1.153
diff -u -p -r1.153 ChangeLog
--- ChangeLog   23 Jan 2005 17:00:58 -0000      1.153
+++ ChangeLog   25 Jan 2005 21:32:09 -0000
@@ -1,3 +1,8 @@
+2005-01-25  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR libfortran/19524
+       * io/read.c (read_f): Don't free uninitialized pointer.
+
 2005-01-23  James A. Morrison  <phython@gcc.gnu.org>
        Paul Brook  <paul@codesourcery.com>

Index: io/read.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/read.c,v
retrieving revision 1.7
diff -u -p -r1.7 read.c
--- io/read.c   12 Jan 2005 21:27:31 -0000      1.7
+++ io/read.c   25 Jan 2005 21:32:09 -0000
@@ -600,8 +600,6 @@ read_f (fnode * f, char *dest, int lengt

  bad_float:
   generate_error (ERROR_READ_VALUE, "Bad value during floating point read");
-  if (buffer != scratch)
-     free_mem (buffer);
   return;

   /* At this point the start of an exponent has been found */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]