summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-01-17 14:39:12 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-01-17 14:39:12 (GMT)
commitc4f1868e88b950d758f200080baadd7989dae593 (patch)
tree373172f0f9bf46de049f8496036cf99c95beceb6
parentfc8d6f4b73c995b6de2e2b1058140192cf1f7e72 (diff)
downloadcpython-c4f1868e88b950d758f200080baadd7989dae593.zip
cpython-c4f1868e88b950d758f200080baadd7989dae593.tar.gz
cpython-c4f1868e88b950d758f200080baadd7989dae593.tar.bz2
Merged revisions 77578 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77578 | mark.dickinson | 2010-01-17 13:37:57 +0000 (Sun, 17 Jan 2010) | 2 lines Issue #7632: Fix a memory leak in _Py_dg_strtod. ........
-rw-r--r--Misc/NEWS5
-rw-r--r--Python/dtoa.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 1098613..fba4060 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,8 +33,9 @@ Core and Builtins
alpha 2, including: (1) a serious 'wrong output' bug that could
occur for long (> 40 digit) input strings, (2) a crash in dtoa.c
that occurred in debug builds when parsing certain long numeric
- strings corresponding to subnormal values, and (3) a number of flaws
- that could lead to incorrectly rounded results.
+ strings corresponding to subnormal values, (3) a memory leak for
+ some values large enough to cause overflow, and (4) a number of
+ flaws that could lead to incorrectly rounded results.
- The __complex__ method is now looked up on the class of instances to make it
consistent with other special methods.
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 9eb8cdb..24ce922 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -1939,8 +1939,14 @@ _Py_dg_strtod(const char *s00, char **se)
dval(&rv) += adj.d;
if ((word0(&rv) & Exp_mask) >=
Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
- if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
+ if (word0(&rv0) == Big0 && word1(&rv0) == Big1) {
+ Bfree(bb);
+ Bfree(bd);
+ Bfree(bs);
+ Bfree(bd0);
+ Bfree(delta);
goto ovfl;
+ }
word0(&rv) = Big0;
word1(&rv) = Big1;
goto cont;