ockam_vault_extern_error_t
's definition/lack of documentation might encourage memory leaks.
#1562
Labels
ockam_vault_extern_error_t
's definition/lack of documentation might encourage memory leaks.
#1562
When filing #1561, I noticed an issue which is plausibly a bit more serious. Specifically,
ockam_vault_extern_error_t::domain
is allocated byCString::into_raw
(which notes that it's C's responsibility to free https://github.com/ockam-network/ockam/blob/develop/implementations/rust/ockam/ockam_ffi/src/error.rs#L37), but no API to free resources managed by theockam_vault_extern_error_t
is provided, nor is the fact that it's needed documented.Moreover, this field being a
const char*
parameter implies that it'd be invalid for the caller to free it. If I saw this in a C api, I'd probably expect that it's a pointer to a static error description string.That said, fixing this is kind of a pain, and maybe it doesn't matter in practice, since errors should be rare — I'm only careful about noticing it since my background includes a lot of FFI work, including a very similar type.
The text was updated successfully, but these errors were encountered: