cvs: ZendEngine2 / zend_ini.c

From: Date: Tue, 12 Apr 2005 13:06:40 +0000
Subject: cvs: ZendEngine2 / zend_ini.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3555@lists.php.net to get a copy of this message
stas Tue Apr 12 09:06:40 2005 EDT Modified files: /ZendEngine2 zend_ini.c Log: fix memory corruption if one on the on_modify handlers errors out http://cvs.php.net/diff.php/ZendEngine2/zend_ini.c?r1=1.36&r2=1.37&ty=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.36 ZendEngine2/zend_ini.c:1.37 --- ZendEngine2/zend_ini.c:1.36 Mon Mar 14 07:53:34 2005 +++ ZendEngine2/zend_ini.c Tue Apr 12 09:06:39 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.36 2005/03/14 12:53:34 zeev Exp $ */ +/* $Id: zend_ini.c,v 1.37 2005/04/12 13:06:39 stas Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -48,7 +48,12 @@ { 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;

« previous php.zend-engine.cvs (#3555) next »