summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2011-08-06 03:14:37 (GMT)
committerKevin B Kenny <kennykb@acm.org>2011-08-06 03:14:37 (GMT)
commit628d9b0a51de38c2efebc8be8eb3346e19272de5 (patch)
treeb5188c4a57c0afc89c1a319939181ef3d4994a1d /generic
parenta954ba397b3a51f24e6aa456de219cc754652f9f (diff)
downloadtcl-628d9b0a51de38c2efebc8be8eb3346e19272de5.zip
tcl-628d9b0a51de38c2efebc8be8eb3346e19272de5.tar.gz
tcl-628d9b0a51de38c2efebc8be8eb3346e19272de5.tar.bz2
Plugged a memory leak in double->string
conversion. [Bug 3386975]
Diffstat (limited to 'generic')
-rwxr-xr-xgeneric/tclStrToD.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 7e76727..2db239e 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -3855,6 +3855,7 @@ StrictBignumConversion(Double* dPtr,
* S = 2**s2 * 5*s5
*/
+ mp_init_multi(&temp, &dig, NULL);
TclBNInitBignumFromWideUInt(&b, bw);
mp_mul_2d(&b, b2, &b);
mp_init_set_int(&S, 1);
@@ -3870,11 +3871,9 @@ StrictBignumConversion(Double* dPtr,
ilim =ilim1;
--k;
}
- mp_init(&temp);
/* Convert the leading digit */
- mp_init(&dig);
i = 0;
mp_div(&b, &S, &dig, &b);
if (dig.used > 1 || dig.dp[0] >= 10) {
@@ -3957,7 +3956,7 @@ StrictBignumConversion(Double* dPtr,
* Endgame - store the location of the decimal point and the end of the
* string.
*/
- mp_clear_multi(&b, &temp, NULL);
+ mp_clear_multi(&b, &S, &temp, &dig, NULL);
*s = '\0';
*decpt = k;
if (endPtr) {