]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: minor cleanups 8529/head
authorVictor Julien <vjulien@oisf.net>
Thu, 9 Feb 2023 15:57:23 +0000 (16:57 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 9 Feb 2023 16:38:10 +0000 (17:38 +0100)
src/stream-tcp.c

index 59b0155f69dff8484bc62263bcaa983e6b630d1a..e4c61dbd26254f7533f70594334ab0b0417f3198 100644 (file)
@@ -1282,12 +1282,11 @@ static int StreamTcp3whsQueueSynAck(TcpSession *ssn, Packet *p)
         return -1;
     }
 
-    TcpStateQueue *q = SCMalloc(sizeof(*q));
+    TcpStateQueue *q = SCCalloc(1, sizeof(*q));
     if (unlikely(q == NULL)) {
         SCLogDebug("ssn %p: =~ SYN/ACK queue failed: alloc failed", ssn);
         return -1;
     }
-    memset(q, 0x00, sizeof(*q));
     StreamTcpIncrMemuse((uint64_t)sizeof(TcpStateQueue));
 
     StreamTcp3whsSynAckToStateQueue(p, q);
@@ -1431,7 +1430,7 @@ static inline bool StateSynSentValidateTimestamp(TcpSession *ssn, Packet *p)
     }
 
     TcpStream *receiver_stream = &ssn->client;
-    uint32_t ts_echo = TCP_GET_TSECR(p);
+    const uint32_t ts_echo = TCP_GET_TSECR(p);
     if ((receiver_stream->flags & STREAMTCP_STREAM_FLAG_TIMESTAMP) != 0) {
         if (receiver_stream->last_ts != 0 && ts_echo != 0 &&
             ts_echo != receiver_stream->last_ts)