]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2012-05-11 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 May 2012 08:14:56 +0000 (08:14 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 May 2012 08:14:56 +0000 (08:14 +0000)
        PR fortran/53310
        * intrinsics/eoshift2.c (eoshift2): Do not leak
        memory by allocating it in the loop.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187395 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/intrinsics/eoshift2.c

index 46f2cf4185324a207c0539da5c41100e7f249c59..a6223fc24c3d644aa5bc72dd38504d4bb48c5b93 100644 (file)
@@ -1,17 +1,23 @@
+2012-05-11  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/53310
+       * intrinsics/eoshift2.c (eoshift2): Do not leak
+       memory by allocating it in the loop.
+
 2012-05-05  Janne Blomqvist  <jb@gcc.gnu.org>
 
-        * config.h.in: Regenerated.
-        * configure: Regenerated.
-        * configure.ac: Add checks for getegid and __secure_getenv.
-        * io/unix.c (P_tmpdir): Fallback definition for macro.
-        (tempfile_open): New function.
-        (tempfile): Use secure_getenv, call tempfile_open to try each
-        directory in turn.
-        * libgfortran.h (DEFAULT_TMPDIR): Remove macro.
-        (secure_getenv): New macro/prototype.
-        * runtime/environ.c (secure_getenv): New function.
-        (variable_table): Rename GFORTRAN_TMPDIR to TMPDIR.
-        * runtime/main.c (find_addr2line): Use secure_getenv.
+       * config.h.in: Regenerated.
+       * configure: Regenerated.
+       * configure.ac: Add checks for getegid and __secure_getenv.
+       * io/unix.c (P_tmpdir): Fallback definition for macro.
+       (tempfile_open): New function.
+       (tempfile): Use secure_getenv, call tempfile_open to try each
+       directory in turn.
+       * libgfortran.h (DEFAULT_TMPDIR): Remove macro.
+       (secure_getenv): New macro/prototype.
+       * runtime/environ.c (secure_getenv): New function.
+       (variable_table): Rename GFORTRAN_TMPDIR to TMPDIR.
+       * runtime/main.c (find_addr2line): Use secure_getenv.
 
 2012-04-22  Tobias Burnus  <burnus@net-b.de>
 
 
 2012-03-15  Janne Blomqvist  <jb@gcc.gnu.org>
 
-        PR libfortran/52434
-        PR libfortran/48878
-        PR libfortran/38199
-        * io/unit.c (get_internal_unit): Default to ROUND_UNSPECIFIED.
-        (init_units): Likewise.
-        * io/write_float.def (determine_precision): New function.
-        (output_float): Take into account buffer with %f format, no need
-        for our own rounding if unspecified or processor specified
-        rounding.
-        (DTOA): Simplify format string, add parameters.
-        (FDTOA): New macros similar to DTOA, but using %f format.
-        (OUTPUT_FLOAT_FMT_G): Stack allocate newf, determine correct
-        precision and fill buffer.
-        (EN_PREC): New macro.
-        (determine_en_precision): New function.
-        (WRITE_FLOAT): For G format, move buffer filling into
-        output_float_FMT_G, use FDTOA for F format.
-        (write_float): Increase buffer due to F format.
+       PR libfortran/52434
+       PR libfortran/48878
+       PR libfortran/38199
+       * io/unit.c (get_internal_unit): Default to ROUND_UNSPECIFIED.
+       (init_units): Likewise.
+       * io/write_float.def (determine_precision): New function.
+       (output_float): Take into account buffer with %f format, no need
+       for our own rounding if unspecified or processor specified
+       rounding.
+       (DTOA): Simplify format string, add parameters.
+       (FDTOA): New macros similar to DTOA, but using %f format.
+       (OUTPUT_FLOAT_FMT_G): Stack allocate newf, determine correct
+       precision and fill buffer.
+       (EN_PREC): New macro.
+       (determine_en_precision): New function.
+       (WRITE_FLOAT): For G format, move buffer filling into
+       output_float_FMT_G, use FDTOA for F format.
+       (write_float): Increase buffer due to F format.
 
 2012-03-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
index d0d0bf14e046690666c1d3e693ec3777c4305c56..ff94176a05819ae089e1300e0d56eadd28c90ccc 100644 (file)
@@ -77,6 +77,10 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
 
       ret->offset = 0;
       ret->dtype = array->dtype;
+
+      /* xmalloc allocates a single byte for zero size.  */
+      ret->base_addr = xmalloc (size * arraysize);
+
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
          index_type ub, str;
@@ -90,10 +94,6 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
              * GFC_DESCRIPTOR_STRIDE(ret,i-1);
 
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
-
-          /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (size * arraysize);
-
         }
     }
   else if (unlikely (compile_options.bounds_check))