mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
girffi: Add hints to indicate ownership transfer into ffi_cif
scan-build thinks that the `atypes` array is leaked, but it’s not. Ownership is transferred into the `ffi_cif` structure, and it’s eventually freed in `gi_callable_info_destroy_closure()`. Try and help the static analysis by adding an explicit ownership transfer annotation. It probably won’t help. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #1767
This commit is contained in:
parent
e2c3581e37
commit
4141eea257
@ -339,7 +339,7 @@ gi_function_invoker_new_for_address (void *addr,
|
||||
|
||||
return ffi_prep_cif (&(invoker->cif), FFI_DEFAULT_ABI, n_args,
|
||||
gi_callable_info_get_ffi_return_type (info),
|
||||
atypes) == FFI_OK;
|
||||
g_steal_pointer (&atypes)) == FFI_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,6 +409,11 @@ gi_callable_info_create_closure (GICallableInfo *callable_info,
|
||||
status = ffi_prep_cif (cif, FFI_DEFAULT_ABI, n_args,
|
||||
gi_callable_info_get_ffi_return_type (callable_info),
|
||||
atypes);
|
||||
|
||||
/* Explicitly store atypes to satisfy static analysers, which can’t see inside
|
||||
* ffi_prep_cif(), and hence assume that it’s leaked. */
|
||||
cif->arg_types = g_steal_pointer (&atypes);
|
||||
|
||||
if (status != FFI_OK)
|
||||
{
|
||||
g_warning ("ffi_prep_cif failed: %d", status);
|
||||
|
Loading…
Reference in New Issue
Block a user