From: Stanislav Malyshev Date: Tue, 12 Apr 2005 12:59:36 +0000 (+0000) Subject: fi memory corruption if one on the on_modify handlers errors out X-Git-Tag: php-5.0.5RC1~446 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b9cca7c0cefb9d864ea47e49a101985e935d1f1;p=php fi memory corruption if one on the on_modify handlers errors out --- diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index e43ecbb833..bc6609c1ea 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -48,7 +48,12 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS { if (ini_entry->modified) { if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); + zend_try { + /* even if on_modify bails out, we have to continue on with restoring, + since there can be allocated variables that would be freed on MM shutdown + and would lead to memory corruption later ini entry is modified again */ + ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); + } zend_end_try(); } efree(ini_entry->value); ini_entry->value = ini_entry->orig_value;