Commit 5450a88f by Tobias Burnus

re PR fortran/53310 (EOSHIFT leaks memory)

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.

From-SVN: r187395
parent c49f925d
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.
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment