]> granicus.if.org Git - php/commitdiff
Fixed memory leaks
authorDmitry Stogov <dmitry@zend.com>
Tue, 2 Sep 2014 22:07:38 +0000 (02:07 +0400)
committerDmitry Stogov <dmitry@zend.com>
Tue, 2 Sep 2014 22:07:38 +0000 (02:07 +0400)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index a1fbba752e46b5618ef3881ed95a1fa44b7e6a0d..69226bafe6bb2a874a5c2d84bebd55f9528ef995 100644 (file)
@@ -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));
index 211890461614b34dcc792a0d8cb59c22f5631433..14a587133ef53165ca7606788bd43de71d33b913 100644 (file)
@@ -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));