From d6836fb345977c5d03b47e761220a4c5cbb96fb0 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 24 May 2025 13:53:15 +0200 Subject: [PATCH] Fix memory leak in intl_datetime_decompose() Closes GH-18635. --- NEWS | 3 +++ ext/intl/common/common_date.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index d712f80818a..a8d6d6ee6fe 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.3.23 +- Intl: + . Fix memory leak in intl_datetime_decompose() on failure. (nielsdos) + - Phar: . Add missing filter cleanups on phar failure. (nielsdos) diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 2a52b7e63be..a412ddcdffc 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -118,6 +118,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, ZVAL_STRING(&zfuncname, "getTimestamp"); if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL) != SUCCESS || Z_TYPE(retval) != IS_LONG) { + zval_ptr_dtor(&retval); spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR,