From 3c2ce89364a13309dd43c7a3c3316d0ecddcd879 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 26 May 2018 17:30:52 +0000 Subject: [PATCH] re PR fortran/85840 (Memory leak in write.c) 2018-05-26 Jerry DeLisle PR libgfortran/85840 * io/write.c (write_float_0): Use separate local variable for the float string length. From-SVN: r260793 --- libgfortran/io/write.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 50ea13364e3..21a265c8f6b 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1566,19 +1566,19 @@ write_float_0 (st_parameter_dt *dtp, const fnode *f, const char *source, int kin char buf_stack[BUF_STACK_SZ]; char str_buf[BUF_STACK_SZ]; char *buffer, *result; - size_t buf_size, res_len; + size_t buf_size, res_len, flt_str_len; /* Precision for snprintf call. */ int precision = get_precision (dtp, f, source, kind); /* String buffer to hold final result. */ result = select_string (dtp, f, str_buf, &res_len, kind); - + buffer = select_buffer (dtp, f, precision, buf_stack, &buf_size, kind); - + get_float_string (dtp, f, source , kind, 0, buffer, - precision, buf_size, result, &res_len); - write_float_string (dtp, result, res_len); + precision, buf_size, result, &flt_str_len); + write_float_string (dtp, result, flt_str_len); if (buf_size > BUF_STACK_SZ) free (buffer); -- 2.30.2