Skip to content

Commit

Permalink
Fixed memory leaks caused by exceptions thrown from destructors (one …
Browse files Browse the repository at this point in the history
…more case).
  • Loading branch information
dstogov committed Dec 6, 2016
1 parent e8109e0 commit 5011a11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -7798,6 +7798,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY, CLASS_FETCH)
zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}

Expand All @@ -7809,6 +7810,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY, CLASS_FETCH)
if (UNEXPECTED(scope->parent == NULL)) {
zend_throw_error(NULL,
"Cannot use \"parent\" when current class scope has no parent");
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(
zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}

Expand All @@ -1919,6 +1920,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(
if (UNEXPECTED(scope->parent == NULL)) {
zend_throw_error(NULL,
"Cannot use \"parent\" when current class scope has no parent");
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);
Expand Down

0 comments on commit 5011a11

Please sign in to comment.