From 82f70c9493257e5ec86ea285b3a38ae334375d80 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 1 Feb 2007 13:45:25 +0000 Subject: [PATCH] fix leaks on error --- ext/standard/string.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/standard/string.c b/ext/standard/string.c index 34609bcdb1..70d26264e8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1881,6 +1881,8 @@ PHP_FUNCTION(strripos) 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 @@ PHP_FUNCTION(strripos) 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; } -- 2.50.1