]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: simplify tx removal interface
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 13 May 2025 13:14:53 +0000 (15:14 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 14 May 2025 19:36:27 +0000 (21:36 +0200)
rust/htp/src/c_api/transaction.rs
src/app-layer-htp.c

index 9830b6183fe515e085b97a4f6bf577ec5b0e2369..a06f4d556e7e3b1f6f4980a7f60db9ad315620ed 100644 (file)
@@ -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)
     }
 }
 
index 78540b4cd0e204d59fff0ff10560fc138e6fdd94..9d6bdd83bc33092a89743b9a6d8ca83e1aaf22bf 100644 (file)
@@ -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);
 }
 
 /**