Merge branch 'fix-strripos-memleak' of https://github.com/reeze/php-src

This commit is contained in:
Xinchen Hui 2015-01-23 17:35:37 +08:00
commit 4369215b8f
2 changed files with 6 additions and 0 deletions

View File

@ -2114,6 +2114,7 @@ PHP_FUNCTION(strripos)
needle = Z_STR_P(zneedle);
} else {
if (php_needle_char(zneedle, ord_needle->val) != SUCCESS) {
STR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
ord_needle->val[1] = '\0';
@ -2121,6 +2122,7 @@ PHP_FUNCTION(strripos)
}
if ((haystack->len == 0) || (needle->len == 0)) {
STR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}

View File

@ -15,6 +15,9 @@ strripos() function
var_dump(@strripos("a", ""));
var_dump(@strripos("", "a"));
var_dump(@strripos("\\\\a", "\\a"));
$fp = fopen(__FILE__, "r");
var_dump(@strripos("", $fp));
?>
--EXPECT--
int(5)
@ -30,4 +33,5 @@ bool(false)
bool(false)
bool(false)
int(1)
bool(false)