if needle is empty free allocated memory

This commit is contained in:
Sterling Hughes 2002-12-26 20:52:42 +00:00
parent ca67d27fb2
commit 457f22c198

View File

@ -1352,6 +1352,9 @@ PHP_FUNCTION(stristr)
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
efree(haystack_orig);
zval_ptr_dtor(haystack);
zval_ptr_dtor(needle);
RETURN_FALSE;
}