@@ -172,12 +172,12 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg)
172
172
* exception handling */
173
173
if (op_array -> last_brk_cont ) {
174
174
int i , j ;
175
- cfg -> loop_start = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
176
- cfg -> loop_cont = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
177
- cfg -> loop_brk = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
175
+
178
176
j = 0 ;
179
177
for (i = 0 ; i < op_array -> last_brk_cont ; i ++ ) {
180
- if (op_array -> brk_cont_array [i ].start >= 0 ) {
178
+ if (op_array -> brk_cont_array [i ].start >= 0 &&
179
+ (op_array -> opcodes [op_array -> brk_cont_array [i ].brk ].opcode == ZEND_FREE ||
180
+ op_array -> opcodes [op_array -> brk_cont_array [i ].brk ].opcode == ZEND_SWITCH_FREE )) {
181
181
int parent = op_array -> brk_cont_array [i ].parent ;
182
182
183
183
while (parent >= 0 &&
@@ -191,6 +191,9 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg)
191
191
}
192
192
}
193
193
if (j ) {
194
+ cfg -> loop_start = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
195
+ cfg -> loop_cont = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
196
+ cfg -> loop_brk = ecalloc (op_array -> last_brk_cont , sizeof (zend_code_block * ));
194
197
j = 0 ;
195
198
for (i = 0 ; i < op_array -> last_brk_cont ; i ++ ) {
196
199
if (op_array -> brk_cont_array [i ].start >= 0 &&
@@ -212,13 +215,7 @@ static int find_code_blocks(zend_op_array *op_array, zend_cfg *cfg)
212
215
}
213
216
op_array -> last_brk_cont = j ;
214
217
} else {
215
- efree (cfg -> loop_start );
216
- efree (cfg -> loop_cont );
217
- efree (cfg -> loop_brk );
218
218
efree (op_array -> brk_cont_array );
219
- cfg -> loop_start = NULL ;
220
- cfg -> loop_cont = NULL ;
221
- cfg -> loop_brk = NULL ;
222
219
op_array -> brk_cont_array = NULL ;
223
220
op_array -> last_brk_cont = 0 ;
224
221
}
0 commit comments