diff options
author | Martin Liska <mliska@suse.cz> | 2017-02-03 09:20:57 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-02-03 08:20:57 +0000 |
commit | 0a95c7e2c93a8d750447fd6ee39a25ed47ca1370 (patch) | |
tree | 3f382dd1d207a1e28faffcd96159ac82fe7d3584 /gcc | |
parent | e806796de03b50f1b8cddaa6e0696ab652f268ef (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-ssa-sprintf.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d8bf2b..2118c33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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. + +2017-02-03 Martin Liska <mliska@suse.cz> + PR ipa/79337 * ipa-prop.c (ipa_node_params_t::insert): Remove current implementation. 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); } } |