aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-02-03 09:20:57 +0100
committerMartin Liska <marxin@gcc.gnu.org>2017-02-03 08:20:57 +0000
commit0a95c7e2c93a8d750447fd6ee39a25ed47ca1370 (patch)
tree3f382dd1d207a1e28faffcd96159ac82fe7d3584 /gcc/gimple-ssa-sprintf.c
parente806796de03b50f1b8cddaa6e0696ab652f268ef (diff)
downloadgcc-0a95c7e2c93a8d750447fd6ee39a25ed47ca1370.zip
gcc-0a95c7e2c93a8d750447fd6ee39a25ed47ca1370.tar.gz
gcc-0a95c7e2c93a8d750447fd6ee39a25ed47ca1370.tar.bz2
Fix memory leaks in gimple-ssa-sprintf.c (PR tree-optimization/79339).
2017-02-03 Martin Liska <mliska@suse.cz> PR tree-optimization/79339 * gimple-ssa-sprintf.c (format_floating_max): Call mpfr_clear. (format_floating): Likewise. From-SVN: r245146
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 9e099f0..10c6d8e 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1501,7 +1501,10 @@ format_floating_max (tree type, char spec, HOST_WIDE_INT prec)
mpfr_from_real (x, &rv, GMP_RNDN);
/* Return a value one greater to account for the leading minus sign. */
- return 1 + get_mpfr_format_length (x, "", prec, spec, 'D');
+ unsigned HOST_WIDE_INT r
+ = 1 + get_mpfr_format_length (x, "", prec, spec, 'D');
+ mpfr_clear (x);
+ return r;
}
/* Return a range representing the minimum and maximum number of bytes
@@ -1739,6 +1742,7 @@ format_floating (const directive &dir, tree arg)
of the result struct. */
*minmax[i] = get_mpfr_format_length (mpfrval, fmtstr, prec[i],
dir.specifier, rndspec);
+ mpfr_clear (mpfrval);
}
}