What changed, and why it matters
This tiny code-quality patch addresses two minor issues found during a pull-request review: one removes an unnecessary `.clone()` call in Tron transaction handling, and the other adds a missing memory-field cleanup for a new Ethereum/Swapkit display field. Neither change is clearly a security fix, but the missing `free_str_ptr!(self.raw_value)` could in theory leave a small amount of heap memory unreleased when a struct is destroyed.
Treat as a low-risk code-quality/hygiene patch. If `raw_value` was recently introduced, verify that all other lifecycle paths (allocation, conversion, and freeing) are consistent to avoid memory leaks or use-after-free bugs. No urgent security action is indicated by this diff alone.
Security signals we found
Memory-management consistency fix: adds missing `free_str_ptr!` for `raw_value` in `DisplaySwapkitContractData::Free`
Code-review cleanup: removes redundant `.clone()` in Tron transaction expiration handling
Evidence from the diff
The commit changes two Rust files. In wrapped_tron.rs, expiration.clone() is replaced with expiration, likely because expiration is already owned or copyable and cloning is redundant. In ethereum/structs.rs, the Free implementation for DisplaySwapkitContractData now also frees self.raw_value. Without this line, the string pointer stored in raw_value would not be released when the struct is dropped, creating a memory leak. The change is defensive and consistent with the other fields in the same Free impl, but the diff alone does not show that the leak is exploitable or that it caused a vulnerability.
Changed components
rust/rust_c/src/ethereum/structs.rsrust/apps/tron/src/transaction/wrapped_tron.rsInspect captured patch +2 / −1
diff --git a/rust/apps/tron/src/transaction/wrapped_tron.rs b/rust/apps/tron/src/transaction/wrapped_tron.rs
index ac6439c..f27ccbf 100644
--- a/rust/apps/tron/src/transaction/wrapped_tron.rs
+++ b/rust/apps/tron/src/transaction/wrapped_tron.rs
@@ -455,7 +455,7 @@ impl WrappedTron {
token_short_name,
fee_limit,
memo: tx.memo.clone(),
- expiration: expiration.clone(),
+ expiration,
})
}
_ => Err(TronError::InvalidRawTxCryptoBytes(
diff --git a/rust/rust_c/src/ethereum/structs.rs b/rust/rust_c/src/ethereum/structs.rs
index aa63bf4..2f60343 100644
--- a/rust/rust_c/src/ethereum/structs.rs
+++ b/rust/rust_c/src/ethereum/structs.rs
@@ -538,6 +538,7 @@ impl Free for DisplaySwapkitContractData {
free_str_ptr!(self.swap_out_asset);
free_str_ptr!(self.receive_address);
free_str_ptr!(self.expiration);
+ free_str_ptr!(self.raw_value);
}
}
Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.