[Python-checkins] r77578 - in python/trunk: Misc/NEWS Python/dtoa.c

mark.dickinson python-checkins at python.org
Sun Jan 17 14:37:57 CET 2010


Author: mark.dickinson
Date: Sun Jan 17 14:37:57 2010
New Revision: 77578

Log:
Issue #7632: Fix a memory leak in _Py_dg_strtod.


Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/dtoa.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Jan 17 14:37:57 2010
@@ -25,8 +25,9 @@
   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 #7319, #7770: Silence DeprecationWarning by default when -3 is not
   used.

Modified: python/trunk/Python/dtoa.c
==============================================================================
--- python/trunk/Python/dtoa.c	(original)
+++ python/trunk/Python/dtoa.c	Sun Jan 17 14:37:57 2010
@@ -1939,8 +1939,14 @@
             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;


More information about the Python-checkins mailing list