Skip to content

Commit 6f2c501

Browse files
committed
Fixed memory leak with unserialize was called multiple times and an abbreviation was stored
1 parent 181623f commit 6f2c501

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/date/php_date.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3130,6 +3130,12 @@ PHP_METHOD(DateTimeImmutable, sub)
31303130

31313131
static void set_timezone_from_timelib_time(php_timezone_obj *tzobj, timelib_time *t)
31323132
{
3133+
/* Free abbreviation if already set */
3134+
if (tzobj->initialized && tzobj->type == TIMELIB_ZONETYPE_ABBR) {
3135+
timelib_free(tzobj->tzi.z.abbr);
3136+
}
3137+
3138+
/* Set new values */
31333139
tzobj->initialized = 1;
31343140
tzobj->type = t->zone_type;
31353141

0 commit comments

Comments
 (0)