Skip to content

Commit 5011a11

Browse files
committed
Fixed memory leaks caused by exceptions thrown from destructors (one more case).
1 parent e8109e0 commit 5011a11

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Zend/zend_vm_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7798,6 +7798,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY, CLASS_FETCH)
77987798
zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
77997799
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
78007800
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
7801+
ZVAL_UNDEF(EX_VAR(opline->result.var));
78017802
HANDLE_EXCEPTION();
78027803
}
78037804

@@ -7809,6 +7810,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY, CLASS_FETCH)
78097810
if (UNEXPECTED(scope->parent == NULL)) {
78107811
zend_throw_error(NULL,
78117812
"Cannot use \"parent\" when current class scope has no parent");
7813+
ZVAL_UNDEF(EX_VAR(opline->result.var));
78127814
HANDLE_EXCEPTION();
78137815
}
78147816
ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);

Zend/zend_vm_execute.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(
19081908
zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
19091909
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
19101910
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
1911+
ZVAL_UNDEF(EX_VAR(opline->result.var));
19111912
HANDLE_EXCEPTION();
19121913
}
19131914

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

0 commit comments

Comments
 (0)