diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2018-05-26 17:30:52 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2018-05-26 17:30:52 +0000 |
commit | 3c2ce89364a13309dd43c7a3c3316d0ecddcd879 (patch) | |
tree | 64d03ecb9df8e01b19df847f3f233f4b154f24f9 /libgfortran/io | |
parent | cf3a2c1ac3f7da9efe7f46e6af764f909dc68719 (diff) | |
download | gcc-3c2ce89364a13309dd43c7a3c3316d0ecddcd879.zip gcc-3c2ce89364a13309dd43c7a3c3316d0ecddcd879.tar.gz gcc-3c2ce89364a13309dd43c7a3c3316d0ecddcd879.tar.bz2 |
re PR fortran/85840 (Memory leak in write.c)
2018-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/85840
* io/write.c (write_float_0): Use separate local variable for
the float string length.
From-SVN: r260793
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/write.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 50ea133..21a265c 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); |