From: Dmitry Stogov Date: Tue, 2 Sep 2014 22:07:38 +0000 (+0400) Subject: Fixed memory leaks X-Git-Tag: PRE_PHP7_REMOVALS~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0940e54ffc73fc470772228f219750727375c384;p=php Fixed memory leaks --- diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index a1fbba752e..69226bafe6 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5061,9 +5061,6 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) } } ZVAL_NEW_STR(EX_VAR(opline->result.var), EG(error_reporting_ini_entry)->value); - if (EG(error_reporting_ini_entry)->value) { - zend_string_addref(EG(error_reporting_ini_entry)->value); - } if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { ZVAL_NEW_STR(&EX(old_error_reporting), EG(error_reporting_ini_entry)->value); } @@ -5079,8 +5076,6 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable; EG(error_reporting_ini_entry)->modified = 1; } - } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) { - zend_string_release(EG(error_reporting_ini_entry)->value); } if (CG(one_char_string)['0']) { EG(error_reporting_ini_entry)->value = CG(one_char_string)['0']; @@ -5108,7 +5103,8 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) EG(error_reporting) = EX_VAR(opline->op1.var)->u2.error_reporting; if (EXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) == IS_STRING)) { if (EXPECTED(EG(error_reporting_ini_entry)->modified && - EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { + EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) && + EG(error_reporting_ini_entry)->value != Z_STR_P(EX_VAR(opline->op1.var))) { zend_string_release(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STR_P(EX_VAR(opline->op1.var)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 2118904616..14a587133e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1121,9 +1121,6 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR } } ZVAL_NEW_STR(EX_VAR(opline->result.var), EG(error_reporting_ini_entry)->value); - if (EG(error_reporting_ini_entry)->value) { - zend_string_addref(EG(error_reporting_ini_entry)->value); - } if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { ZVAL_NEW_STR(&EX(old_error_reporting), EG(error_reporting_ini_entry)->value); } @@ -1139,8 +1136,6 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable; EG(error_reporting_ini_entry)->modified = 1; } - } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) { - zend_string_release(EG(error_reporting_ini_entry)->value); } if (CG(one_char_string)['0']) { EG(error_reporting_ini_entry)->value = CG(one_char_string)['0']; @@ -10043,7 +10038,8 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ EG(error_reporting) = EX_VAR(opline->op1.var)->u2.error_reporting; if (EXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) == IS_STRING)) { if (EXPECTED(EG(error_reporting_ini_entry)->modified && - EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { + EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) && + EG(error_reporting_ini_entry)->value != Z_STR_P(EX_VAR(opline->op1.var))) { zend_string_release(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STR_P(EX_VAR(opline->op1.var));