cvs: ZendEngine2(PHP_5_1) / zend_strtod.c /tests zend_strtod.phpt
| From: | Antony Dovgal | Date: | Tue, 14 Feb 2006 22:10:55 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_1) / zend_strtod.c /tests zend_strtod.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4581@lists.php.net to get a copy of this message | ||
tony2001 Tue Feb 14 22:10:55 2006 UTC
Added files: (Branch: PHP_5_1)
/ZendEngine2/tests zend_strtod.phpt
Modified files:
/ZendEngine2 zend_strtod.c
Log:
fix leak in zend_strtod() on big doubles
add new test
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_strtod.c?r1=1.17&r2=1.17.2.1&diff_format=u
Index: ZendEngine2/zend_strtod.c
diff -u ZendEngine2/zend_strtod.c:1.17 ZendEngine2/zend_strtod.c:1.17.2.1
--- ZendEngine2/zend_strtod.c:1.17 Thu Feb 17 04:44:52 2005
+++ ZendEngine2/zend_strtod.c Tue Feb 14 22:10:55 2006
@@ -1250,7 +1250,7 @@
_double rv, rv0;
Long L;
ULong y, z;
- Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
+ Bigint *bb, *bb1, *bd, *bd0, *bs, *delta, *tmp;
double result;
CONST char decimal_point = '.';
@@ -1776,5 +1776,21 @@
if (se)
*se = (char *)s;
result = sign ? -value(rv) : value(rv);
+
+ for (i = 0; i <= Kmax; i++) {
+ Bigint **listp = &freelist[i];
+ while ((tmp = *listp) != NULL) {
+ *listp = tmp->next;
+ free(tmp);
+ }
+ freelist[i] = NULL;
+ }
+
+ while (p5s) {
+ tmp = p5s;
+ p5s = p5s->next;
+ free(tmp);
+ }
+
return result;
}
http://cvs.php.net/viewcvs.cgi/ZendEngine2/tests/zend_strtod.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/zend_strtod.phpt
+++ ZendEngine2/tests/zend_strtod.phpt