Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Apr 12, 2018
1 parent 9322b43 commit 5fe6d21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
if (U_FAILURE(status)) {
intl_error_set(NULL, status, "rbbi_create_instance: unable to "
"create instance from compiled rules", 0);
delete rbbi;
return;
}
#else
Expand Down
11 changes: 10 additions & 1 deletion ext/intl/tests/rbbiter___construct_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ $rules = <<<RULES
RULES;
$rbbi = new IntlRuleBasedBreakIterator($rules);
var_dump(get_class($rbbi));

try {
$obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu');
} catch (IntlException $e) {
var_dump(intl_get_error_code(), intl_get_error_message());
}

?>
==DONE==
--EXPECT--
string(26) "IntlRuleBasedBreakIterator"
==DONE==
int(1)
string(93) "rbbi_create_instance: unable to create instance from compiled rules: U_ILLEGAL_ARGUMENT_ERROR"
==DONE==

0 comments on commit 5fe6d21

Please sign in to comment.