summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2011-08-06 03:19:00 (GMT)
committerKevin B Kenny <kennykb@acm.org>2011-08-06 03:19:00 (GMT)
commit9857d60d3bdddc10acd4194358603b92a37aa60d (patch)
tree049ebf51b6868056c16d3d76ea3b2ac73c7d2ed2
parent86876436a44b247ec6423fbead92b7c3ce8a2032 (diff)
parent628d9b0a51de38c2efebc8be8eb3346e19272de5 (diff)
downloadtcl-9857d60d3bdddc10acd4194358603b92a37aa60d.zip
tcl-9857d60d3bdddc10acd4194358603b92a37aa60d.tar.gz
tcl-9857d60d3bdddc10acd4194358603b92a37aa60d.tar.bz2
Plugged a memory leak in double->string
conversion. [Bug 3386975]
-rw-r--r--ChangeLog5
-rwxr-xr-xgeneric/tclStrToD.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c233e6d..1523872 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-05 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tclStrToD.c: Plugged a memory leak in double->string
+ conversion. [Bug 3386975]
+
2011-08-05 Donal K. Fellows <dkf@users.sf.net>
* generic/tclAssembly.c (AssembleOneLine): Ensure that memory isn't
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 8a961ff..c2d4ed8 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -3875,6 +3875,7 @@ StrictBignumConversion(
* 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);
@@ -3889,13 +3890,11 @@ StrictBignumConversion(
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) {
@@ -3983,7 +3982,7 @@ StrictBignumConversion(
* string.
*/
- mp_clear_multi(&b, &temp, NULL);
+ mp_clear_multi(&b, &S, &temp, &dig, NULL);
*s = '\0';
*decpt = k;
if (endPtr) {