com php-src: Fixed memory leaks: ext/intl/converter/converter.c
| From: | Xinchen Hui | Date: | Sun, 29 Jun 2014 09:48:10 +0000 |
| Subject: | com php-src: Fixed memory leaks: ext/intl/converter/converter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79128@lists.php.net to get a copy of this message | ||
Commit: 52c27f32faac0e3ac65c022adcda1cdc0977e2bf
Author: Xinchen Hui <laruence@php.net> Sun, 29 Jun 2014 17:48:10 +0800
Parents: 3b7e19ad73c28eb4830174a0c98a8f3be5d702d3
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=52c27f32faac0e3ac65c022adcda1cdc0977e2bf
Log:
Fixed memory leaks
Changed paths:
M ext/intl/converter/converter.c
Diff:
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index af78a3a..930fe95 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -698,6 +698,7 @@ static zend_bool php_converter_do_convert(UConverter *dest_cnv, char **pdest, in
efree(temp);
return 0;
}
+
dest = safe_emalloc(sizeof(char), dest_len, sizeof(char));
/* Convert to final encoding */
@@ -773,9 +774,10 @@ static PHP_METHOD(UConverter, convert) {
reverse ? objval->dest : objval->src,
str, str_len,
objval TSRMLS_CC)) {
- RETURN_STRINGL(dest, dest_len);
+ RETVAL_STRINGL(dest, dest_len);
//???
efree(dest);
+ return;
} else {
RETURN_FALSE;
}
@@ -832,6 +834,7 @@ static PHP_METHOD(UConverter, transcode) {
RETVAL_STRINGL(out, out_len);
//???
efree(out);
+ return;
}
if (U_FAILURE(error)) {
@@ -1034,8 +1037,8 @@ static zend_object *php_converter_object_ctor(zend_class_entry *ce,
php_converte
php_converter_object *objval;
objval = ecalloc(1, sizeof(php_converter_object) + sizeof(zval) * (ce->default_properties_count
- 1));
- objval->obj..ce = ce;
+ zend_object_std_init(&objval->obj, ce TSRMLS_CC );
#ifdef ZTS
objval->tsrm_ls = TSRMLS_C;
#endif
@@ -1102,6 +1105,7 @@ int php_converter_minit(INIT_FUNC_ARGS) {
php_converter_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_converter_ce->create_object = php_converter_create_object;
memcpy(&php_converter_object_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
+ php_converter_object_handlers.offset = XtOffsetOf(php_converter_object, obj);
php_converter_object_handlers.clone_obj = php_converter_clone_object;
php_converter_object_handlers.free_obj = php_converter_free_object;