cvs: php-src(PHP_5_2) /ext/standard string.c
| From: | Antony Dovgal | Date: | Thu, 01 Feb 2007 13:45:25 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-42924@lists.php.net to get a copy of this message | ||
tony2001 Thu Feb 1 13:45:25 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard string.c
Log:
fix leaks on error
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.37&r2=1.445.2.14.2.38&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.37 php-src/ext/standard/string.c:1.445.2.14.2.38
--- php-src/ext/standard/string.c:1.445.2.14.2.37 Mon Jan 8 14:24:59 2007
+++ php-src/ext/standard/string.c Thu Feb 1 13:45:25 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.37 2007/01/08 14:24:59 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.38 2007/02/01 13:45:25 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1881,6 +1881,8 @@
if (offset >= 0) {
if (offset > haystack_len) {
+ efree(needle_dup);
+ efree(haystack_dup);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack
string");
RETURN_FALSE;
}
@@ -1888,6 +1890,8 @@
e = haystack_dup + haystack_len - needle_len;
} else {
if (-offset > haystack_len) {
+ efree(needle_dup);
+ efree(haystack_dup);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack
string");
RETURN_FALSE;
}