summaryrefslogtreecommitdiff
path: root/Zend/zend_ini.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2005-04-12 13:06:39 +0000
committerStanislav Malyshev <stas@php.net>2005-04-12 13:06:39 +0000
commit5ddf66e004bdb40bc31a0bf9cdb9b1ede5b0d0b2 (patch)
treebaa145271b2266102dafebc2330bf6f221ed691d /Zend/zend_ini.c
parentce73b66466337af13e22690cb434973fcce9dc23 (diff)
downloadphp-git-5ddf66e004bdb40bc31a0bf9cdb9b1ede5b0d0b2.tar.gz
fix memory corruption if one on the on_modify handlers errors out
Diffstat (limited to 'Zend/zend_ini.c')
-rw-r--r--Zend/zend_ini.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index 90ef3406fc..aedc1e14ad 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;