summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {