aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgfortran/ChangeLog66
-rw-r--r--libgfortran/intrinsics/eoshift2.c8
2 files changed, 40 insertions, 34 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 46f2cf4..a6223fc 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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>
@@ -479,24 +485,24 @@
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>
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index d0d0bf1..ff94176 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -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))