fix(integration_tests): fix double free

This commit is contained in:
Pravdyvy 2026-08-07 16:21:46 +03:00
parent aa9f59648e
commit 62de1b3e8d
2 changed files with 3 additions and 3 deletions

View File

@ -1005,7 +1005,6 @@ fn test_wallet_ffi_transfer_public() -> Result<()> {
assert!(is_included);
unsafe {
wallet_ffi_free_transfer_result(&raw mut transfer_result);
wallet_ffi_destroy(wallet_ffi_handle);
}

View File

@ -157,6 +157,7 @@ impl Default for FfiAccountList {
/// Result of a transfer operation.
#[repr(C)]
#[derive(Debug)]
pub struct FfiTransferResult {
// TODO: Replace with HashType FFI representation
/// Transaction hash (null-terminated string, or null on failure).
@ -176,11 +177,11 @@ impl Default for FfiTransferResult {
impl FfiTransferResult {
#[must_use]
/// Casting valid results hash into bytes.
/// Casting valid results hash into bytes. Effectively frees `FfiTransferResult`.
///
/// # Safety
/// Field `tx_hash` must be a valid pointer into transaction hash.
pub unsafe fn tx_hash_bytes(&self) -> FfiBytes32 {
pub unsafe fn tx_hash_bytes(self) -> FfiBytes32 {
let cstring = unsafe { CString::from_raw(self.tx_hash) };
let rstring = cstring.into_string().expect("Must be a valid Rust string");