]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/tx: avoid a call to memset
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 4 Jun 2024 06:55:54 +0000 (08:55 +0200)
committerVictor Julien <victor@inliniac.net>
Sun, 4 Aug 2024 07:19:42 +0000 (09:19 +0200)
just initialize the small struct to zero

src/app-layer-parser.c
src/detect.c

index 27eb654a01e9b6615b71183bc11a0ac80c515fd9..1317b51488ea1b5c3de178194fd1bf15d2e414fb 100644 (file)
@@ -742,8 +742,7 @@ void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *p
     const AppProto alproto = f->alproto;
 
     AppLayerGetTxIteratorFunc IterFunc = AppLayerGetTxIterator(ipproto, alproto);
-    AppLayerGetTxIterState state;
-    memset(&state, 0, sizeof(state));
+    AppLayerGetTxIterState state = { 0 };
 
     SCLogDebug("called: %s, tag_txs_as_inspected %s",direction==0?"toserver":"toclient",
             tag_txs_as_inspected?"true":"false");
index aeb2fb625c7728d783ba8720fdfce6dd46f63f61..0b31a8471e85c448c21b95fa13cec16818951a88 100644 (file)
@@ -1430,8 +1430,7 @@ static void DetectRunTx(ThreadVars *tv,
     const int tx_end_state = AppLayerParserGetStateProgressCompletionStatus(alproto, flow_flags);
 
     AppLayerGetTxIteratorFunc IterFunc = AppLayerGetTxIterator(ipproto, alproto);
-    AppLayerGetTxIterState state;
-    memset(&state, 0, sizeof(state));
+    AppLayerGetTxIterState state = { 0 };
 
     while (1) {
         AppLayerGetTxIterTuple ires = IterFunc(ipproto, alproto, alstate, tx_id_min, total_txs, &state);