stream: minor code cleanups

pull/15429/head
Victor Julien 4 months ago
parent 24e7f3439e
commit 9d693a72b6

@ -267,9 +267,7 @@ static void *TcpSegmentPoolAlloc(void)
return NULL; return NULL;
} }
TcpSegment *seg = NULL; TcpSegment *seg = SCMalloc(sizeof(TcpSegment));
seg = SCMalloc(sizeof (TcpSegment));
if (unlikely(seg == NULL)) if (unlikely(seg == NULL))
return NULL; return NULL;
@ -287,18 +285,17 @@ static void *TcpSegmentPoolAlloc(void)
"TcpSegmentPcapHdrStorage"); "TcpSegmentPcapHdrStorage");
SCFree(seg); SCFree(seg);
return NULL; return NULL;
} else { }
seg->pcap_hdr_storage->alloclen = sizeof(uint8_t) * TCPSEG_PKT_HDR_DEFAULT_SIZE;
seg->pcap_hdr_storage->pkt_hdr = seg->pcap_hdr_storage->alloclen = sizeof(uint8_t) * TCPSEG_PKT_HDR_DEFAULT_SIZE;
SCCalloc(1, sizeof(uint8_t) * TCPSEG_PKT_HDR_DEFAULT_SIZE); seg->pcap_hdr_storage->pkt_hdr = SCCalloc(1, sizeof(uint8_t) * TCPSEG_PKT_HDR_DEFAULT_SIZE);
if (seg->pcap_hdr_storage->pkt_hdr == NULL) { if (seg->pcap_hdr_storage->pkt_hdr == NULL) {
SCLogDebug("Unable to allocate memory for " SCLogDebug("Unable to allocate memory for "
"packet header data within " "packet header data within "
"TcpSegmentPcapHdrStorage"); "TcpSegmentPcapHdrStorage");
SCFree(seg->pcap_hdr_storage); SCFree(seg->pcap_hdr_storage);
SCFree(seg); SCFree(seg);
return NULL; return NULL;
}
} }
StreamTcpReassembleIncrMemuse(memuse); StreamTcpReassembleIncrMemuse(memuse);

Loading…
Cancel
Save