diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-11 08:14:56 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-11 08:14:56 +0000 |
commit | 79f3fcdb3b92366702d376de77a9e8941a3228e8 (patch) | |
tree | 23915ca900d79e44e436266b0860c9c6b1c480b8 /libgfortran | |
parent | 22b7bad85d67d924c2edb07ad3aac8fd1bbb0ac2 (diff) | |
download | ppe42-gcc-79f3fcdb3b92366702d376de77a9e8941a3228e8.tar.gz ppe42-gcc-79f3fcdb3b92366702d376de77a9e8941a3228e8.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187395 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 66 | ||||
-rw-r--r-- | libgfortran/intrinsics/eoshift2.c | 8 |
2 files changed, 40 insertions, 34 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 46f2cf41853..a6223fc24c3 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 d0d0bf14e04..ff94176a058 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)) |