From: Philippe Antoine Date: Tue, 4 Jun 2024 06:55:54 +0000 (+0200) Subject: detect/tx: avoid a call to memset X-Git-Tag: suricata-8.0.0-beta1~961 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ad15f5c37c0913e117ab36dc281e9fd5970caab;p=thirdparty%2Fsuricata.git detect/tx: avoid a call to memset just initialize the small struct to zero --- diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 27eb654a01..1317b51488 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -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"); diff --git a/src/detect.c b/src/detect.c index aeb2fb625c..0b31a8471e 100644 --- a/src/detect.c +++ b/src/detect.c @@ -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);