diff --git a/NEWS b/NEWS index 6550a7a9641d..6d06b25e97a9 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ PHP NEWS - Intl: . Fixed grapheme_strrev() treating UBRK_DONE as a byte index and leaving the result without a terminating NUL. (iliaal) + . Fixed a double-free when Calendar::createInstance() or + IntlCalendar::fromDateTime() fails after adopting a TimeZone. (iliaal) - Phar: . Fixed Phar archives being automatically detected when ".phar" only occurs diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 0c6e68a65e21..f4c9cb36cded 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -96,7 +96,6 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(intlcal_create_instance) Calendar *cal = Calendar::createInstance(timeZone, Locale::createFromName(locale_str), status); if (UNEXPECTED(cal == NULL)) { - delete timeZone; intl_error_set(NULL, status, "Error creating ICU Calendar object"); RETURN_NULL(); } @@ -1073,7 +1072,6 @@ PHP_INTL_FUNCTION_WITH_ERROR_RESET(intlcal_from_date_time) cal = Calendar::createInstance(timeZone, Locale::createFromName(locale_str), status); if (UNEXPECTED(cal == NULL)) { - delete timeZone; intl_error_set(NULL, status, "error creating ICU Calendar object"); goto error;