File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -4897,7 +4897,11 @@ void zend_compile_foreach(zend_ast *ast TSRMLS_DC) {
4897
4897
void zend_compile_if (zend_ast * ast TSRMLS_DC ) {
4898
4898
zend_ast_list * list = zend_ast_get_list (ast );
4899
4899
uint32_t i ;
4900
- uint32_t * jmp_opnums = safe_emalloc (sizeof (uint32_t ), list -> children - 1 , 0 );
4900
+ uint32_t * jmp_opnums ;
4901
+
4902
+ if (list -> children > 1 ) {
4903
+ jmp_opnums = safe_emalloc (sizeof (uint32_t ), list -> children - 1 , 0 );
4904
+ }
4901
4905
4902
4906
for (i = 0 ; i < list -> children ; ++ i ) {
4903
4907
zend_ast * elem_ast = list -> child [i ];
@@ -4922,11 +4926,12 @@ void zend_compile_if(zend_ast *ast TSRMLS_DC) {
4922
4926
}
4923
4927
}
4924
4928
4925
- for (i = 0 ; i < list -> children - 1 ; ++ i ) {
4926
- zend_update_jump_target_to_next (jmp_opnums [i ] TSRMLS_CC );
4929
+ if (list -> children > 1 ) {
4930
+ for (i = 0 ; i < list -> children - 1 ; ++ i ) {
4931
+ zend_update_jump_target_to_next (jmp_opnums [i ] TSRMLS_CC );
4932
+ }
4933
+ efree (jmp_opnums );
4927
4934
}
4928
-
4929
- efree (jmp_opnums );
4930
4935
}
4931
4936
4932
4937
void zend_compile_switch (zend_ast * ast TSRMLS_DC ) {
You can’t perform that action at this time.
0 commit comments