mirror of
https://github.com/php/php-src.git
synced 2026-04-03 14:12:38 +02:00
Fixed memory leaks with DatePeriod::__unserialise
This commit is contained in:
@@ -5077,6 +5077,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
if (period_obj->start != NULL) {
|
||||
timelib_time_dtor(period_obj->start);
|
||||
}
|
||||
period_obj->start = timelib_time_clone(date_obj->time);
|
||||
period_obj->start_ce = Z_OBJCE_P(ht_entry);
|
||||
} else if (Z_TYPE_P(ht_entry) != IS_NULL) {
|
||||
@@ -5091,6 +5094,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
if (period_obj->end != NULL) {
|
||||
timelib_time_dtor(period_obj->end);
|
||||
}
|
||||
period_obj->end = timelib_time_clone(date_obj->time);
|
||||
} else if (Z_TYPE_P(ht_entry) != IS_NULL) {
|
||||
return 0;
|
||||
@@ -5104,6 +5110,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && instanceof_function(Z_OBJCE_P(ht_entry), date_ce_interface)) {
|
||||
php_date_obj *date_obj;
|
||||
date_obj = Z_PHPDATE_P(ht_entry);
|
||||
if (period_obj->current != NULL) {
|
||||
timelib_time_dtor(period_obj->current);
|
||||
}
|
||||
period_obj->current = timelib_time_clone(date_obj->time);
|
||||
} else if (Z_TYPE_P(ht_entry) != IS_NULL) {
|
||||
return 0;
|
||||
@@ -5117,6 +5126,9 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, Has
|
||||
if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_interval) {
|
||||
php_interval_obj *interval_obj;
|
||||
interval_obj = Z_PHPINTERVAL_P(ht_entry);
|
||||
if (period_obj->interval != NULL) {
|
||||
timelib_rel_time_dtor(period_obj->interval);
|
||||
}
|
||||
period_obj->interval = timelib_rel_time_clone(interval_obj->diff);
|
||||
} else { /* interval is required */
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user