Merged revisions 77579 via svnmerge from
authorMark Dickinson <dickinsm@gmail.com>
Sun, 17 Jan 2010 14:41:03 +0000 (14:41 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sun, 17 Jan 2010 14:41:03 +0000 (14:41 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r77579 | mark.dickinson | 2010-01-17 14:39:12 +0000 (Sun, 17 Jan 2010) | 9 lines

  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.
  ........
................

Misc/NEWS
Python/dtoa.c

index 1fc9986e9651c7d757fa6c73ce3b7b9adcd21aab..ef0e3f0482bf2db8214f79504efbbd8a74d40fea 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,8 +21,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.
 
 - Issue #7604: Deleting an unset slotted attribute did not raise an
   AttributeError.
index 9eb8cdba895d356757bba0c67926302d842ca7e4..24ce9226079443c876d97f0954c08d6fe80cfd7c 100644 (file)
@@ -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;