diff --git a/rust/htp/src/c_api/transaction.rs b/rust/htp/src/c_api/transaction.rs index 9830b6183f..a06f4d556e 100644 --- a/rust/htp/src/c_api/transaction.rs +++ b/rust/htp/src/c_api/transaction.rs @@ -8,9 +8,9 @@ use std::convert::{TryFrom, TryInto}; /// # Safety /// When calling this method, you have to ensure that tx is either properly initialized or NULL #[no_mangle] -pub unsafe extern "C" fn htp_tx_destroy(connp: *mut ConnectionParser, tx: *const Transaction) { - if let (Some(connp), Some(tx)) = (connp.as_mut(), tx.as_ref()) { - connp.remove_tx(tx.index) +pub unsafe extern "C" fn htp_tx_destroy(connp: *mut ConnectionParser, index: usize) { + if let Some(connp) = connp.as_mut() { + connp.remove_tx(index) } } diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 78540b4cd0..9d6bdd83bc 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -536,11 +536,7 @@ static void HTPStateTransactionFree(void *state, uint64_t id) HtpState *s = (HtpState *)state; SCLogDebug("state %p, id %"PRIu64, s, id); - - htp_tx_t *tx = HTPStateGetTx(s, id); - if (tx != NULL) { - htp_tx_destroy(s->connp, tx); - } + htp_tx_destroy(s->connp, id); } /**