Skip to content

Commit 76e852e

Browse files
committed
Fixed memory leak with manual calls to DateInterval::__unserialize
1 parent f869a54 commit 76e852e

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
@@ -4104,6 +4104,12 @@ PHP_METHOD(DateInterval, __construct)
41044104

41054105
static void php_date_interval_initialize_from_hash(zval **return_value, php_interval_obj **intobj, HashTable *myht) /* {{{ */
41064106
{
4107+
/* If ->diff is already set, then we need to free it first */
4108+
if ((*intobj)->diff) {
4109+
timelib_rel_time_dtor((*intobj)->diff);
4110+
}
4111+
4112+
/* Set new value */
41074113
(*intobj)->diff = timelib_rel_time_ctor();
41084114

41094115
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \

0 commit comments

Comments
 (0)