- Fix the crash Thies was experiencing (returning a function call could cause a crash)

- Fix the leak Thies was experiencing (@fcall() leaked)
This commit is contained in:
Zeev Suraski 1999-12-20 16:05:36 +00:00
parent f455a484bd
commit be1bb28355
3 changed files with 9 additions and 0 deletions

View File

@ -303,6 +303,8 @@ END_EXTERN_C()
if ((pzv)->refcount>1) { \
zval_copy_ctor(&(zv)); \
(pzv)->refcount--; \
} else { \
efree(pzv); \
} \
INIT_PZVAL(&(zv));

View File

@ -2060,8 +2060,13 @@ void do_begin_silence(znode *strudel_token CLS_DC)
void do_end_silence(znode *strudel_token CLS_DC)
{
zend_op *last_opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
if ((last_opline->opcode == ZEND_DO_FCALL) || (last_opline->opcode == ZEND_DO_FCALL_BY_NAME)) {
last_opline->result.u.EA.type |= EXT_TYPE_UNUSED;
}
opline->opcode = ZEND_END_SILENCE;
opline->op1 = *strudel_token;
SET_UNUSED(opline->op2);

View File

@ -1562,6 +1562,7 @@ do_fcall_common:
zval *retval_ptr;
zval **retval_ptr_ptr;
SUSPEND_GARBAGE();
if ((EG(active_op_array)->return_reference == ZEND_RETURN_REF) &&
(opline->op1.op_type != IS_CONST) &&
(opline->op1.op_type != IS_TMP_VAR)) {
@ -1595,6 +1596,7 @@ do_fcall_common:
(*EG(return_value_ptr_ptr))->is_ref = 0;
}
}
RESUME_GARBAGE();
#if SUPPORT_INTERACTIVE
op_array->last_executed_op_number = opline-op_array->opcodes;
#endif