]> granicus.if.org Git - php/commitdiff
Fixed leak in RuleBasedBreakIterator constructor
authorGustavo Lopes <glopes@safelinq.com>
Mon, 23 Jul 2012 14:51:28 +0000 (16:51 +0200)
committerGustavo Lopes <glopes@safelinq.com>
Mon, 23 Jul 2012 14:51:28 +0000 (16:51 +0200)
The leak occurred in case of error.

ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp

index 61fb5746829328c8de048f1972ab5d07d1aa04e6..454e5249fde9628fc6cc39100cd7af76a0579b4a 100644 (file)
@@ -70,6 +70,7 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
                        smart_str_free(&parse_error_str);
                        intl_error_set_custom_msg(NULL, msg, 1 TSRMLS_CC);
                        efree(msg);
+                       delete rbbi;
                        RETURN_NULL();
                }
        } else { // compiled
@@ -78,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 TSRMLS_CC);
+                       delete rbbi;
                        RETURN_NULL();
                }
 #else