Fixed segfault in intlgregcal_create_instance

This commit is contained in:
Xinchen Hui 2014-06-29 22:56:27 +08:00
parent f096bc4d86
commit 499293449b
2 changed files with 7 additions and 1 deletions

View file

@ -182,7 +182,8 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
zend_object_store_ctor_failed(Z_OBJ(orig) TSRMLS_CC);
zval_dtor(&orig);
RETURN_NULL();
}
}

View file

@ -69,6 +69,11 @@ typedef struct _intl_data {
if( U_FAILURE( INTL_DATA_ERROR_CODE((obj)) ) ) \
{ \
intl_errors_set_custom_msg( INTL_DATA_ERROR_P((obj)), msg, 0 TSRMLS_CC ); \
/* yes, this is ugly, but it alreay is */ \
if (return_value != getThis()) { \
zval_dtor(return_value); \
RETURN_NULL(); \
} \
Z_OBJ_P(return_value) = NULL; \
return; \
}