andrei Fri Nov 17 16:44:23 2006 UTC
Modified files:
/php-src/ext/standard string.c
Log:
Fix memory leaks and segfault.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.611&r2=1.612&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.611 php-src/ext/standard/string.c:1.612
--- php-src/ext/standard/string.c:1.611 Thu Nov 16 20:33:44 2006
+++ php-src/ext/standard/string.c Fri Nov 17 16:44:23 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.611 2006/11/16 20:33:44 derick Exp $ */
+/* $Id: string.c,v 1.612 2006/11/17 16:44:23 andrei Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -3905,7 +3905,7 @@
UChar *key_string;
tmp_hash = emalloc(sizeof(HashTable));
- zend_hash_init(tmp_hash, 0, ZVAL_PTR_DTOR, NULL, 0);
+ zend_hash_init(tmp_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
/* Loop over the two strings and prepare the hash entries */
do
@@ -3922,7 +3922,8 @@
}
MAKE_STD_ZVAL(entry);
- ZVAL_UNICODEL(entry, str_to + prev_to_offset,
to_cp_offset - prev_to_offset, 0);
+ ZVAL_UNICODEL(entry, str_to + prev_to_offset,
to_cp_offset - prev_to_offset, 1);
+ Z_USTRVAL_P(entry)[to_cp_offset -
prev_to_offset] = 0;
key_string = eumalloc(from_cp_offset -
prev_from_offset + 1);
memcpy(key_string, str_from + prev_from_offset,
UBYTES(from_cp_offset - prev_from_offset));
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php