mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
fix memleaks correctly and make valgrind happy
This commit is contained in:
parent
c6f6997504
commit
dc7aa2a949
1 changed files with 18 additions and 24 deletions
|
@ -1883,12 +1883,12 @@ PHP_FUNCTION(mb_http_output)
|
||||||
PHP_FUNCTION(mb_detect_order)
|
PHP_FUNCTION(mb_detect_order)
|
||||||
{
|
{
|
||||||
size_t argc = ZEND_NUM_ARGS();
|
size_t argc = ZEND_NUM_ARGS();
|
||||||
zval *arg1;
|
zval **arg1;
|
||||||
int n, size;
|
int n, size;
|
||||||
enum mbfl_no_encoding *list, *entry;
|
enum mbfl_no_encoding *list, *entry;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "|z", &arg1) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "|Z", &arg1) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1907,9 +1907,9 @@ PHP_FUNCTION(mb_detect_order)
|
||||||
} else {
|
} else {
|
||||||
list = NULL;
|
list = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
switch (Z_TYPE_P(arg1)) {
|
switch (Z_TYPE_PP(arg1)) {
|
||||||
case IS_ARRAY:
|
case IS_ARRAY:
|
||||||
if (!php_mb_parse_encoding_array(arg1, &list, &size, 0 TSRMLS_CC)) {
|
if (!php_mb_parse_encoding_array(*arg1, &list, &size, 0 TSRMLS_CC)) {
|
||||||
if (list) {
|
if (list) {
|
||||||
efree(list);
|
efree(list);
|
||||||
}
|
}
|
||||||
|
@ -1917,15 +1917,13 @@ PHP_FUNCTION(mb_detect_order)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
convert_to_string_ex(&arg1);
|
convert_to_string_ex(arg1);
|
||||||
if (!php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0 TSRMLS_CC)) {
|
if (!php_mb_parse_encoding_list(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), &list, &size, 0 TSRMLS_CC)) {
|
||||||
if (list) {
|
if (list) {
|
||||||
efree(list);
|
efree(list);
|
||||||
}
|
}
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1947,9 +1945,9 @@ PHP_FUNCTION(mb_detect_order)
|
||||||
Sets the current substitute_character or returns the current substitute_character */
|
Sets the current substitute_character or returns the current substitute_character */
|
||||||
PHP_FUNCTION(mb_substitute_character)
|
PHP_FUNCTION(mb_substitute_character)
|
||||||
{
|
{
|
||||||
zval *arg1;
|
zval **arg1;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg1) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Z", &arg1) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1966,36 +1964,32 @@ PHP_FUNCTION(mb_substitute_character)
|
||||||
} else {
|
} else {
|
||||||
RETVAL_TRUE;
|
RETVAL_TRUE;
|
||||||
|
|
||||||
switch (Z_TYPE_P(arg1)) {
|
switch (Z_TYPE_PP(arg1)) {
|
||||||
case IS_STRING:
|
case IS_STRING:
|
||||||
if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
|
if (strncasecmp("none", Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) {
|
||||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
|
||||||
} else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
|
} else if (strncasecmp("long", Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) {
|
||||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
|
||||||
} else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) {
|
} else if (strncasecmp("entity", Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) {
|
||||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
|
||||||
} else {
|
} else {
|
||||||
convert_to_long_ex(&arg1);
|
convert_to_long_ex(arg1);
|
||||||
|
|
||||||
if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) {
|
if (Z_LVAL_PP(arg1) < 0xffff && Z_LVAL_PP(arg1) > 0x0) {
|
||||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
||||||
MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1);
|
MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
} else {
|
} else {
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
convert_to_long_ex(&arg1);
|
convert_to_long_ex(arg1);
|
||||||
if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) {
|
if (Z_LVAL_PP(arg1) < 0xffff && Z_LVAL_PP(arg1) > 0x0) {
|
||||||
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
|
||||||
MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1);
|
MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
} else {
|
} else {
|
||||||
zval_ptr_dtor(&arg1);
|
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character.");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue