Skip to content

Commit

Permalink
allocating memory for result is minimum size (this is due to the spec…
Browse files Browse the repository at this point in the history
…ifics for ffi)
  • Loading branch information
aodinokov committed Aug 15, 2024
1 parent 0b08521 commit 5bc0cd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/c_ffi_call/value_ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ metac_value_t * metac_new_value_with_call_result(metac_value_t * p_param_storage
}
_check_(res_sz <= 0, NULL);

void * p_res_mem = calloc(1, res_sz); // make alloca maybe
void * p_res_mem = calloc(1, res_sz<sizeof(ffi_arg)?sizeof(ffi_arg):res_sz);
p_res_value = metac_new_value(p_res_entry, p_res_mem);
if (p_res_value == NULL) {
free(p_res_mem);
Expand Down

0 comments on commit 5bc0cd4

Please sign in to comment.