Skip to content

Commit 000b314

Browse files
committed
Do not use zend_fcall_info_argn() in ext-curl
Using zend_fcall_info_argn() allocates the ZVALs on the heap and they need to be freed afterwards. Handle adding them to the FCI manually so to keep them stack allocated.
1 parent 09c92a1 commit 000b314

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ext/curl/multi.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,14 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
397397

398398
zend_fcall_info_init(&t->func_name, 0, &fci, &t->fci_cache, NULL, NULL);
399399

400-
zend_fcall_info_argn(
401-
&fci, 3,
402-
pz_parent_ch,
403-
&pz_ch,
404-
&headers
405-
);
400+
ZEND_ASSERT(pz_parent_ch);
401+
zval call_args[3] = {*pz_parent_ch, pz_ch, headers};
406402

403+
fci.param_count = 3;
404+
fci.params = call_args;
407405
fci.retval = &retval;
408406

409407
error = zend_call_function(&fci, &t->fci_cache);
410-
zend_fcall_info_args_clear(&fci, 1);
411408
zval_ptr_dtor_nogc(&headers);
412409

413410
if (error == FAILURE) {

0 commit comments

Comments
 (0)