From 62de1b3e8d820ef1d7c9d430c3ea48f03ac5187f Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Fri, 7 Aug 2026 16:21:46 +0300 Subject: [PATCH] fix(integration_tests): fix double free --- integration_tests/tests/wallet_ffi.rs | 1 - lez/wallet-ffi/src/types.rs | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration_tests/tests/wallet_ffi.rs b/integration_tests/tests/wallet_ffi.rs index d421291f..e9fe3920 100644 --- a/integration_tests/tests/wallet_ffi.rs +++ b/integration_tests/tests/wallet_ffi.rs @@ -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); } diff --git a/lez/wallet-ffi/src/types.rs b/lez/wallet-ffi/src/types.rs index cf872338..154d87f8 100644 --- a/lez/wallet-ffi/src/types.rs +++ b/lez/wallet-ffi/src/types.rs @@ -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");