[Python-checkins] r71309 - python/branches/py3k-short-float-repr/Python/pystrtod.c
mark.dickinson
python-checkins at python.org
Mon Apr 6 15:54:08 CEST 2009
Author: mark.dickinson
Date: Mon Apr 6 15:54:08 2009
New Revision: 71309
Log:
Always call _Py_dg_freedtoa on the result of a (successful) _Py_dg_dtoa call.
Modified:
python/branches/py3k-short-float-repr/Python/pystrtod.c
Modified: python/branches/py3k-short-float-repr/Python/pystrtod.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/pystrtod.c (original)
+++ python/branches/py3k-short-float-repr/Python/pystrtod.c Mon Apr 6 15:54:08 2009
@@ -553,7 +553,7 @@
precision = 1;
/* _Py_dg_dtoa returns a digit string (no decimal point or
- exponent) */
+ exponent). Must be matched by a call to _Py_dg_freedtoa. */
digits = _Py_dg_dtoa(d, mode, precision, &decpt, &sign, &digits_end);
assert(digits_end != NULL && digits_end >= digits);
n_digits = digits_end - digits;
@@ -583,8 +583,7 @@
buf += 3;
assert(0);
}
- *buf = '0円';
- return;
+ goto exit;
}
/* We got digits back, format them. */
@@ -632,8 +631,7 @@
break;
default:
PyErr_BadInternalCall();
- *buf = '0円';
- return;
+ goto exit;
}
/* Always add a negative sign, and a plus sign if always_add_sign. */
@@ -694,8 +692,9 @@
exp_len = sprintf(buf, "%+.02d", decpt-1);
buf += exp_len;
}
-
- *buf++ = '0円';
+ exit:
+ *buf = '0円';
+ _Py_dg_freedtoa(digits);
}
More information about the Python-checkins
mailing list