felipe Thu, 04 Aug 2011 00:59:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=314218
Log:
- Fixed possible efree(NULL) (bug #55296)
Bug: https://bugs.php.net/55296 (Closed) wrong use efree(NULL) in intl
Changed paths:
U php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
U php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_attr.c
U php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_attr.c
U php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_parse.c
U php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_string.c
U php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_util.c
U php/php-src/branches/PHP_5_3/ext/intl/idn/idn.c
U php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_attr.c
U php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_parse.c
U php/php-src/branches/PHP_5_3/ext/intl/normalizer/normalizer_normalize.c
U php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
U php/php-src/branches/PHP_5_4/ext/intl/dateformat/dateformat_attr.c
U php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_attr.c
U php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_parse.c
U php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
U php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_util.c
U php/php-src/branches/PHP_5_4/ext/intl/idn/idn.c
U php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_attr.c
U php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_parse.c
U php/php-src/branches/PHP_5_4/ext/intl/normalizer/normalizer_normalize.c
U
php/php-src/branches/PHP_5_4/ext/intl/transliterator/transliterator_methods.c
U php/php-src/trunk/ext/intl/collator/collator_compare.c
U php/php-src/trunk/ext/intl/dateformat/dateformat_attr.c
U php/php-src/trunk/ext/intl/formatter/formatter_attr.c
U php/php-src/trunk/ext/intl/formatter/formatter_parse.c
U php/php-src/trunk/ext/intl/grapheme/grapheme_string.c
U php/php-src/trunk/ext/intl/grapheme/grapheme_util.c
U php/php-src/trunk/ext/intl/idn/idn.c
U php/php-src/trunk/ext/intl/msgformat/msgformat_attr.c
U php/php-src/trunk/ext/intl/msgformat/msgformat_parse.c
U php/php-src/trunk/ext/intl/normalizer/normalizer_normalize.c
U php/php-src/trunk/ext/intl/transliterator/transliterator_methods.c
Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -74,7 +74,9 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting first argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
RETURN_FALSE;
}
@@ -88,8 +90,12 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting second argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
- efree( ustr2 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
+ if (ustr2) {
+ efree( ustr2 );
+ }
RETURN_FALSE;
}
Modified: php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_attr.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -276,7 +276,9 @@
udat_applyPattern(DATE_FORMAT_OBJECT(dfo), (UBool)is_pattern_localized, svalue, slength);
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS(dfo, "Error setting symbol value");
RETURN_TRUE;
Modified: php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_attr.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -233,7 +233,9 @@
/* Actually set new attribute value. */
unum_setTextAttribute(FORMATTER_OBJECT(nfo), attribute, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting text attribute" );
RETURN_TRUE;
@@ -326,7 +328,9 @@
/* Actually set the symbol. */
unum_setSymbol(FORMATTER_OBJECT(nfo), symbol, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting symbol value" );
RETURN_TRUE;
@@ -406,7 +410,9 @@
/* TODO: add parse error information */
unum_applyPattern(FORMATTER_OBJECT(nfo), 0, svalue, slength, NULL, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting pattern value" );
RETURN_TRUE;
Modified: php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_parse.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/formatter/formatter_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -107,7 +107,9 @@
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
}
@@ -161,7 +163,9 @@
zval_dtor(zposition);
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
/* Convert parsed currency to UTF-8 and pass it back to caller. */
Modified: php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_string.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_string.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_string.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -84,13 +84,17 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
RETURN_NULL();
}
ret_len = grapheme_split_string(ustring, ustring_len, NULL, 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
if (ret_len >= 0) {
RETVAL_LONG(ret_len);
@@ -447,7 +451,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
RETURN_FALSE;
}
@@ -485,7 +491,9 @@
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: start not contained in string", 1 TSRMLS_CC );
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
RETURN_FALSE;
}
@@ -499,7 +507,9 @@
status = U_ZERO_ERROR;
intl_convert_utf16_to_utf8((char **)&sub_str, &sub_str_len, ustr + sub_str_start_pos, ustr_len - sub_str_start_pos, &status);
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
ubrk_close( bi );
if ( U_FAILURE( status ) ) {
@@ -509,6 +519,7 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
+
efree( sub_str );
RETURN_FALSE;
@@ -897,7 +908,9 @@
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, pstr, str_len);
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
if ( NULL != next ) {
Modified: php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_util.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_util.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/grapheme/grapheme_util.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -170,7 +170,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -187,7 +189,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
}
@@ -203,8 +207,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
}
@@ -260,8 +268,12 @@
}
exit:
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
@@ -295,7 +307,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -310,8 +324,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
-
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
@@ -332,8 +347,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
@@ -347,8 +366,12 @@
*puchar_pos = ubrk_current(bi);
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
Modified: php/php-src/branches/PHP_5_3/ext/intl/idn/idn.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/idn/idn.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/idn/idn.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -85,7 +85,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree(ustring);
+ if (ustring) {
+ efree(ustring);
+ }
RETURN_FALSE;
} else {
UParseError parse_error;
Modified: php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_attr.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -90,7 +90,9 @@
/* TODO: add parse error information */
umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo));
- efree(spattern);
+ if (spattern) {
+ efree(spattern);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Error setting symbol value");
if(mfo->mf_data.orig_format) {
Modified: php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_parse.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/msgformat/msgformat_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -40,7 +40,9 @@
INTL_METHOD_CHECK_STATUS(mfo, "Converting parse string failed");
umsg_parse_helper(MSG_FORMAT_OBJECT(mfo), &count, &fargs, usource, usrc_len, &INTL_DATA_ERROR_CODE(mfo));
- efree(usource);
+ if (usource) {
+ efree(usource);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Parsing failed");
array_init(return_value);
Modified: php/php-src/branches/PHP_5_3/ext/intl/normalizer/normalizer_normalize.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/normalizer/normalizer_normalize.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_3/ext/intl/normalizer/normalizer_normalize.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -96,7 +96,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
@@ -220,7 +222,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
Modified: php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -74,7 +74,9 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting first argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
RETURN_FALSE;
}
@@ -88,8 +90,12 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting second argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
- efree( ustr2 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
+ if (ustr2) {
+ efree( ustr2 );
+ }
RETURN_FALSE;
}
Modified: php/php-src/branches/PHP_5_4/ext/intl/dateformat/dateformat_attr.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/dateformat/dateformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/dateformat/dateformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -276,7 +276,9 @@
udat_applyPattern(DATE_FORMAT_OBJECT(dfo), (UBool)is_pattern_localized, svalue, slength);
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS(dfo, "Error setting symbol value");
RETURN_TRUE;
Modified: php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_attr.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -233,7 +233,9 @@
/* Actually set new attribute value. */
unum_setTextAttribute(FORMATTER_OBJECT(nfo), attribute, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting text attribute" );
RETURN_TRUE;
@@ -326,7 +328,9 @@
/* Actually set the symbol. */
unum_setSymbol(FORMATTER_OBJECT(nfo), symbol, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting symbol value" );
RETURN_TRUE;
@@ -406,7 +410,9 @@
/* TODO: add parse error information */
unum_applyPattern(FORMATTER_OBJECT(nfo), 0, svalue, slength, NULL, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting pattern value" );
RETURN_TRUE;
Modified: php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_parse.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/formatter/formatter_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -107,7 +107,9 @@
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
}
@@ -161,7 +163,9 @@
zval_dtor(zposition);
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
/* Convert parsed currency to UTF-8 and pass it back to caller. */
Modified: php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -84,13 +84,17 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
RETURN_NULL();
}
ret_len = grapheme_split_string(ustring, ustring_len, NULL, 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
if (ret_len >= 0) {
RETVAL_LONG(ret_len);
@@ -447,7 +451,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
RETURN_FALSE;
}
@@ -485,7 +491,9 @@
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: start not contained in string", 1 TSRMLS_CC );
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
RETURN_FALSE;
}
@@ -499,7 +507,9 @@
status = U_ZERO_ERROR;
intl_convert_utf16_to_utf8((char **)&sub_str, &sub_str_len, ustr + sub_str_start_pos, ustr_len - sub_str_start_pos, &status);
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
ubrk_close( bi );
if ( U_FAILURE( status ) ) {
@@ -509,6 +519,7 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
+
efree( sub_str );
RETURN_FALSE;
@@ -897,7 +908,9 @@
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, pstr, str_len);
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
if ( NULL != next ) {
Modified: php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_util.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_util.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_util.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -170,7 +170,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -187,7 +189,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
}
@@ -203,8 +207,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
}
@@ -260,8 +268,12 @@
}
exit:
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
@@ -295,7 +307,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -310,8 +324,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
-
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
@@ -332,8 +347,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
@@ -347,8 +366,12 @@
*puchar_pos = ubrk_current(bi);
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
Modified: php/php-src/branches/PHP_5_4/ext/intl/idn/idn.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/idn/idn.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/idn/idn.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -85,7 +85,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree(ustring);
+ if (ustring) {
+ efree(ustring);
+ }
RETURN_FALSE;
} else {
UParseError parse_error;
Modified: php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_attr.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -90,7 +90,9 @@
/* TODO: add parse error information */
umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo));
- efree(spattern);
+ if (spattern) {
+ efree(spattern);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Error setting symbol value");
if(mfo->mf_data.orig_format) {
Modified: php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_parse.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/msgformat/msgformat_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -40,7 +40,9 @@
INTL_METHOD_CHECK_STATUS(mfo, "Converting parse string failed");
umsg_parse_helper(MSG_FORMAT_OBJECT(mfo), &count, &fargs, usource, usrc_len, &INTL_DATA_ERROR_CODE(mfo));
- efree(usource);
+ if (usource) {
+ efree(usource);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Parsing failed");
array_init(return_value);
Modified: php/php-src/branches/PHP_5_4/ext/intl/normalizer/normalizer_normalize.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/normalizer/normalizer_normalize.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/normalizer/normalizer_normalize.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -96,7 +96,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
@@ -220,7 +222,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
Modified: php/php-src/branches/PHP_5_4/ext/intl/transliterator/transliterator_methods.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/transliterator/transliterator_methods.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/branches/PHP_5_4/ext/intl/transliterator/transliterator_methods.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -60,7 +60,9 @@
/* Open ICU Transliterator. */
utrans = utrans_openU( ustr_id, ustr_id_len, (UTransDirection ) direction,
NULL, -1, &parse_error, TRANSLITERATOR_ERROR_CODE_P( to ) );
- efree( ustr_id );
+ if (ustr_id) {
+ efree( ustr_id );
+ }
if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to ) ) )
{
@@ -172,7 +174,9 @@
/* Open ICU Transliterator. */
utrans = utrans_openU( id, ( sizeof( id ) - 1 ) / ( sizeof( *id ) ), (UTransDirection ) direction,
ustr_rules, ustr_rules_len, &parse_error, TRANSLITERATOR_ERROR_CODE_P( to ) );
- efree( ustr_rules );
+ if (ustr_rules) {
+ efree( ustr_rules );
+ }
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( to ) TSRMLS_CC );
if( U_FAILURE( INTL_DATA_ERROR_CODE( to ) ) )
Modified: php/php-src/trunk/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/trunk/ext/intl/collator/collator_compare.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/collator/collator_compare.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -74,7 +74,9 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting first argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
RETURN_FALSE;
}
@@ -88,8 +90,12 @@
/* Set error messages. */
intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
"Error converting second argument to UTF-16", 0 TSRMLS_CC );
- efree( ustr1 );
- efree( ustr2 );
+ if (ustr1) {
+ efree( ustr1 );
+ }
+ if (ustr2) {
+ efree( ustr2 );
+ }
RETURN_FALSE;
}
Modified: php/php-src/trunk/ext/intl/dateformat/dateformat_attr.c
===================================================================
--- php/php-src/trunk/ext/intl/dateformat/dateformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/dateformat/dateformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -276,7 +276,9 @@
udat_applyPattern(DATE_FORMAT_OBJECT(dfo), (UBool)is_pattern_localized, svalue, slength);
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS(dfo, "Error setting symbol value");
RETURN_TRUE;
Modified: php/php-src/trunk/ext/intl/formatter/formatter_attr.c
===================================================================
--- php/php-src/trunk/ext/intl/formatter/formatter_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/formatter/formatter_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -233,7 +233,9 @@
/* Actually set new attribute value. */
unum_setTextAttribute(FORMATTER_OBJECT(nfo), attribute, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting text attribute" );
RETURN_TRUE;
@@ -326,7 +328,9 @@
/* Actually set the symbol. */
unum_setSymbol(FORMATTER_OBJECT(nfo), symbol, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting symbol value" );
RETURN_TRUE;
@@ -406,7 +410,9 @@
/* TODO: add parse error information */
unum_applyPattern(FORMATTER_OBJECT(nfo), 0, svalue, slength, NULL, &INTL_DATA_ERROR_CODE(nfo));
- efree(svalue);
+ if (svalue) {
+ efree(svalue);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Error setting pattern value" );
RETURN_TRUE;
Modified: php/php-src/trunk/ext/intl/formatter/formatter_parse.c
===================================================================
--- php/php-src/trunk/ext/intl/formatter/formatter_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/formatter/formatter_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -107,7 +107,9 @@
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
}
@@ -161,7 +163,9 @@
zval_dtor(zposition);
ZVAL_LONG(zposition, position);
}
- efree(sstr);
+ if (sstr) {
+ efree(sstr);
+ }
INTL_METHOD_CHECK_STATUS( nfo, "Number parsing failed" );
/* Convert parsed currency to UTF-8 and pass it back to caller. */
Modified: php/php-src/trunk/ext/intl/grapheme/grapheme_string.c
===================================================================
--- php/php-src/trunk/ext/intl/grapheme/grapheme_string.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/grapheme/grapheme_string.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -84,13 +84,17 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
RETURN_NULL();
}
ret_len = grapheme_split_string(ustring, ustring_len, NULL, 0 TSRMLS_CC );
- efree( ustring );
+ if (ustring) {
+ efree( ustring );
+ }
if (ret_len >= 0) {
RETVAL_LONG(ret_len);
@@ -447,7 +451,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
RETURN_FALSE;
}
@@ -485,7 +491,9 @@
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: start not contained in string", 1 TSRMLS_CC );
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
RETURN_FALSE;
}
@@ -499,7 +507,9 @@
status = U_ZERO_ERROR;
intl_convert_utf16_to_utf8((char **)&sub_str, &sub_str_len, ustr + sub_str_start_pos, ustr_len - sub_str_start_pos, &status);
- efree( ustr );
+ if (ustr) {
+ efree( ustr );
+ }
ubrk_close( bi );
if ( U_FAILURE( status ) ) {
@@ -509,6 +519,7 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 TSRMLS_CC );
+
efree( sub_str );
RETURN_FALSE;
@@ -897,7 +908,9 @@
ret_pos = (*grapheme_extract_iters[extract_type])(bi, size, pstr, str_len);
- efree(ustr);
+ if (ustr) {
+ efree(ustr);
+ }
ubrk_close(bi);
if ( NULL != next ) {
Modified: php/php-src/trunk/ext/intl/grapheme/grapheme_util.c
===================================================================
--- php/php-src/trunk/ext/intl/grapheme/grapheme_util.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/grapheme/grapheme_util.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -170,7 +170,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -187,7 +189,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
}
@@ -203,8 +207,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
}
@@ -260,8 +268,12 @@
}
exit:
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
@@ -295,7 +307,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
return -1;
}
@@ -310,8 +324,9 @@
if ( NULL == puhaystack ) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC );
-
- efree( uhaystack );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
ubrk_close (bi);
return -1;
@@ -332,8 +347,12 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return -1;
@@ -347,8 +366,12 @@
*puchar_pos = ubrk_current(bi);
- efree( uhaystack );
- efree( uneedle );
+ if (uhaystack) {
+ efree( uhaystack );
+ }
+ if (uneedle) {
+ efree( uneedle );
+ }
ubrk_close (bi);
return ret_pos;
Modified: php/php-src/trunk/ext/intl/idn/idn.c
===================================================================
--- php/php-src/trunk/ext/intl/idn/idn.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/idn/idn.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -85,7 +85,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree(ustring);
+ if (ustring) {
+ efree(ustring);
+ }
RETURN_FALSE;
} else {
UParseError parse_error;
Modified: php/php-src/trunk/ext/intl/msgformat/msgformat_attr.c
===================================================================
--- php/php-src/trunk/ext/intl/msgformat/msgformat_attr.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/msgformat/msgformat_attr.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -90,7 +90,9 @@
/* TODO: add parse error information */
umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo));
- efree(spattern);
+ if (spattern) {
+ efree(spattern);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Error setting symbol value");
if(mfo->mf_data.orig_format) {
Modified: php/php-src/trunk/ext/intl/msgformat/msgformat_parse.c
===================================================================
--- php/php-src/trunk/ext/intl/msgformat/msgformat_parse.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/msgformat/msgformat_parse.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -40,7 +40,9 @@
INTL_METHOD_CHECK_STATUS(mfo, "Converting parse string failed");
umsg_parse_helper(MSG_FORMAT_OBJECT(mfo), &count, &fargs, usource, usrc_len, &INTL_DATA_ERROR_CODE(mfo));
- efree(usource);
+ if (usource) {
+ efree(usource);
+ }
INTL_METHOD_CHECK_STATUS(mfo, "Parsing failed");
array_init(return_value);
Modified: php/php-src/trunk/ext/intl/normalizer/normalizer_normalize.c
===================================================================
--- php/php-src/trunk/ext/intl/normalizer/normalizer_normalize.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/normalizer/normalizer_normalize.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -96,7 +96,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
@@ -220,7 +222,9 @@
/* Set error messages. */
intl_error_set_custom_msg( NULL, "Error converting string to UTF-16.", 0 TSRMLS_CC );
- efree( uinput );
+ if (uinput) {
+ efree( uinput );
+ }
RETURN_FALSE;
}
Modified: php/php-src/trunk/ext/intl/transliterator/transliterator_methods.c
===================================================================
--- php/php-src/trunk/ext/intl/transliterator/transliterator_methods.c 2011-08-03 22:00:28 UTC (rev 314217)
+++ php/php-src/trunk/ext/intl/transliterator/transliterator_methods.c 2011-08-04 00:59:43 UTC (rev 314218)
@@ -60,7 +60,9 @@
/* Open ICU Transliterator. */
utrans = utrans_openU( ustr_id, ustr_id_len, (UTransDirection ) direction,
NULL, -1, &parse_error, TRANSLITERATOR_ERROR_CODE_P( to ) );
- efree( ustr_id );
+ if (ustr_id) {
+ efree( ustr_id );
+ }
if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to ) ) )
{
@@ -172,7 +174,9 @@
/* Open ICU Transliterator. */
utrans = utrans_openU( id, ( sizeof( id ) - 1 ) / ( sizeof( *id ) ), (UTransDirection ) direction,
ustr_rules, ustr_rules_len, &parse_error, TRANSLITERATOR_ERROR_CODE_P( to ) );
- efree( ustr_rules );
+ if (ustr_rules) {
+ efree( ustr_rules );
+ }
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( to ) TSRMLS_CC );
if( U_FAILURE( INTL_DATA_ERROR_CODE( to ) ) )
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php