diff --git a/src/decode-ethernet.c b/src/decode-ethernet.c index de08202dce..abe9e958d6 100644 --- a/src/decode-ethernet.c +++ b/src/decode-ethernet.c @@ -134,7 +134,7 @@ static int DecodeEthernetTest01 (void) 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -142,7 +142,6 @@ static int DecodeEthernetTest01 (void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth), NULL); @@ -160,14 +159,13 @@ static int DecodeEthernetTestDceTooSmall(void) 0x94, 0x56, 0x00, 0x01, 0x89, 0x03, }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); ThreadVars tv; DecodeThreadVars dtv; memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth), NULL); @@ -196,14 +194,13 @@ static int DecodeEthernetTestDceNextTooSmall(void) 0x94, 0x56, 0x00, 0x01, }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); ThreadVars tv; DecodeThreadVars dtv; memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth), NULL); diff --git a/src/decode-icmpv4.c b/src/decode-icmpv4.c index 5322a77701..7801f5fc1b 100644 --- a/src/decode-icmpv4.c +++ b/src/decode-icmpv4.c @@ -379,7 +379,7 @@ static int DecodeICMPV4test01(void) 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -389,7 +389,6 @@ static int DecodeICMPV4test01(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&dtv, 0, sizeof(DecodeThreadVars)); @@ -431,7 +430,7 @@ static int DecodeICMPV4test02(void) 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -441,7 +440,6 @@ static int DecodeICMPV4test02(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); @@ -480,7 +478,7 @@ static int DecodeICMPV4test03(void) 0x01, 0x11, 0xde, 0xfd, 0xc0, 0xa8, 0x01, 0x0d, 0xd1, 0x55, 0xe3, 0x93, 0x8b, 0x12, 0x82, 0xaa, 0x00, 0x28, 0x7c, 0xdd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -490,7 +488,6 @@ static int DecodeICMPV4test03(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); @@ -560,7 +557,7 @@ static int DecodeICMPV4test04(void) 0x3e, 0x36, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x16, 0xd0, 0x72, 0x04, 0x00, 0x00, 0x02, 0x04, 0x05, 0x8a, 0x04, 0x02, 0x08, 0x0a }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -570,7 +567,6 @@ static int DecodeICMPV4test04(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); @@ -630,7 +626,7 @@ static int DecodeICMPV4test05(void) 0xd6, 0xbd, 0xc0, 0xa8, 0x02, 0x05, 0x3d, 0x23, 0xa1, 0x23, 0x04, 0x18, 0x00, 0x50, 0xd2, 0x08, 0xc2, 0x48, }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -640,7 +636,6 @@ static int DecodeICMPV4test05(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); @@ -737,7 +732,7 @@ static int ICMPV4InvalidType07(void) 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38}; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -747,7 +742,6 @@ static int ICMPV4InvalidType07(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); @@ -781,7 +775,7 @@ static int DecodeICMPV4test08(void) uint8_t raw_icmpv4[] = { 0x08, 0x00, 0x78, 0x47, 0xfc, 0x55, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -791,7 +785,6 @@ static int DecodeICMPV4test08(void) memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); FlowInitConfig(FLOW_QUIET); diff --git a/src/decode-icmpv6.c b/src/decode-icmpv6.c index 8809fce5ea..86662ca824 100644 --- a/src/decode-icmpv6.c +++ b/src/decode-icmpv6.c @@ -609,7 +609,7 @@ static int ICMPV6ParamProbTest01(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x08, 0xb5, 0x99, 0xc3, 0xde, 0x40 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; @@ -620,7 +620,6 @@ static int ICMPV6ParamProbTest01(void) ipv6dst = (uint32_t*) &raw_ipv6[24]; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -665,7 +664,7 @@ static int ICMPV6PktTooBigTest01(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; @@ -676,7 +675,6 @@ static int ICMPV6PktTooBigTest01(void) ipv6dst = (uint32_t*) &raw_ipv6[24]; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -724,7 +722,7 @@ static int ICMPV6TimeExceedTest01(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; @@ -735,7 +733,6 @@ static int ICMPV6TimeExceedTest01(void) ipv6dst = (uint32_t*) &raw_ipv6[24]; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -783,7 +780,7 @@ static int ICMPV6DestUnreachTest01(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; @@ -794,7 +791,6 @@ static int ICMPV6DestUnreachTest01(void) ipv6dst = (uint32_t*) &raw_ipv6[24]; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -834,14 +830,13 @@ static int ICMPV6EchoReqTest01(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -880,14 +875,13 @@ static int ICMPV6EchoRepTest01(void) 0x00, 0x00, 0x00, 0x00, 0x01, 0x81, 0x00, 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -933,14 +927,13 @@ static int ICMPV6ParamProbTest02(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x08, 0xb5, 0x99, 0xc3, 0xde, 0x40 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -976,14 +969,13 @@ static int ICMPV6PktTooBigTest02(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1015,14 +1007,13 @@ static int ICMPV6TimeExceedTest02(void) /* The icmpv6 header is broken in the checksum (so we dont have a complete header) */ - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1056,14 +1047,13 @@ static int ICMPV6DestUnreachTest02(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1093,14 +1083,13 @@ static int ICMPV6EchoReqTest02(void) 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1130,14 +1119,13 @@ static int ICMPV6EchoRepTest02(void) 0x00, 0x00, 0x00, 0x00, 0x01, 0x81, 0x01, 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1170,14 +1158,13 @@ static int ICMPV6PayloadTest01(void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1204,14 +1191,13 @@ static int ICMPV6RouterSolicitTestKnownCode(void) 0x85, 0x00, 0xbe, 0xb0, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1237,14 +1223,13 @@ static int ICMPV6RouterSolicitTestUnknownCode(void) 0x85, 0x01, 0xbe, 0xaf, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1270,14 +1255,13 @@ static int ICMPV6RouterAdvertTestKnownCode(void) 0x86, 0x00, 0xbd, 0xb0, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1303,14 +1287,13 @@ static int ICMPV6RouterAdvertTestUnknownCode(void) 0x86, 0x01, 0xbd, 0xaf, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1336,14 +1319,13 @@ static int ICMPV6NeighbourSolicitTestKnownCode(void) 0x87, 0x00, 0xbc, 0xb0, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1369,14 +1351,13 @@ static int ICMPV6NeighbourSolicitTestUnknownCode(void) 0x87, 0x01, 0xbc, 0xaf, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1402,14 +1383,13 @@ static int ICMPV6NeighbourAdvertTestKnownCode(void) 0x88, 0x00, 0xbb, 0xb0, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1435,14 +1415,13 @@ static int ICMPV6NeighbourAdvertTestUnknownCode(void) 0x88, 0x01, 0xbb, 0xaf, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1468,14 +1447,13 @@ static int ICMPV6RedirectTestKnownCode(void) 0x89, 0x00, 0xba, 0xb0, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1501,14 +1479,13 @@ static int ICMPV6RedirectTestUnknownCode(void) 0x89, 0x01, 0xba, 0xaf, 0x00, 0x00, 0x00, 0x00 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); @@ -1551,14 +1528,13 @@ static int ICMPV6CalculateValidChecksumWithFCS(void) }; uint16_t csum = *(((uint16_t *)(raw_ipv6 + 64))); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); IPV6Hdr ip6h; ThreadVars tv; DecodeThreadVars dtv; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); diff --git a/src/decode-ipv4.c b/src/decode-ipv4.c index 17246f7251..efe18c776e 100644 --- a/src/decode-ipv4.c +++ b/src/decode-ipv4.c @@ -1633,14 +1633,13 @@ static int DecodeEthernetTestIPv4Opt(void) DefragInit(); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); ThreadVars tv; DecodeThreadVars dtv; memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth), NULL); diff --git a/src/decode-mpls.c b/src/decode-mpls.c index 5f589979f8..940383ea2c 100644 --- a/src/decode-mpls.c +++ b/src/decode-mpls.c @@ -143,7 +143,7 @@ static int DecodeMPLSTestHeaderTooSmall(void) 0x00, 0x00, 0x11 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) { return 0; } @@ -152,7 +152,6 @@ static int DecodeMPLSTestHeaderTooSmall(void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeMPLS(&tv, &dtv, p, pkt, sizeof(pkt), NULL); @@ -231,7 +230,7 @@ static int DecodeMPLSTestBadLabelRouterAlert(void) 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) { return 0; } @@ -240,7 +239,6 @@ static int DecodeMPLSTestBadLabelRouterAlert(void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeMPLS(&tv, &dtv, p, pkt, sizeof(pkt), NULL); @@ -271,7 +269,7 @@ static int DecodeMPLSTestBadLabelImplicitNull(void) 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) { return 0; } @@ -280,7 +278,6 @@ static int DecodeMPLSTestBadLabelImplicitNull(void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeMPLS(&tv, &dtv, p, pkt, sizeof(pkt), NULL); @@ -311,7 +308,7 @@ static int DecodeMPLSTestBadLabelReserved(void) 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) { return 0; } @@ -320,7 +317,6 @@ static int DecodeMPLSTestBadLabelReserved(void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeMPLS(&tv, &dtv, p, pkt, sizeof(pkt), NULL); @@ -355,7 +351,7 @@ static int DecodeMPLSTestUnknownPayloadType(void) 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) { return 0; } @@ -364,7 +360,6 @@ static int DecodeMPLSTestUnknownPayloadType(void) memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); DecodeMPLS(&tv, &dtv, p, pkt, sizeof(pkt), NULL); diff --git a/src/detect-content.c b/src/detect-content.c index bc7872dc1e..98fa8d80dc 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -1001,7 +1001,7 @@ static int DetectContentLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pkts { int result = 0; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; DecodeThreadVars dtv; @@ -1009,7 +1009,6 @@ static int DetectContentLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pkts ThreadVars th_v; DetectEngineThreadCtx *det_ctx = NULL; - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&th_v, 0, sizeof(th_v)); diff --git a/src/detect-dsize.c b/src/detect-dsize.c index 5143026e24..b254c58b74 100644 --- a/src/detect-dsize.c +++ b/src/detect-dsize.c @@ -886,7 +886,7 @@ static int DetectDsizeIcmpv6Test01 (void) 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV6Hdr ip6h; @@ -897,7 +897,6 @@ static int DetectDsizeIcmpv6Test01 (void) DetectEngineThreadCtx *det_ctx = NULL; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ip6h, 0, sizeof(IPV6Hdr)); memset(&th_v, 0, sizeof(ThreadVars)); diff --git a/src/detect-engine-event.c b/src/detect-engine-event.c index 486d4968e6..3ddce4cf52 100644 --- a/src/detect-engine-event.c +++ b/src/detect-engine-event.c @@ -340,7 +340,7 @@ static int EngineEventTestParse05 (void) */ static int EngineEventTestParse06 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -350,7 +350,6 @@ static int EngineEventTestParse06 (void) memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); ENGINE_SET_EVENT(p,PPP_PKT_TOO_SMALL); diff --git a/src/detect-flowbits.c b/src/detect-flowbits.c index ae462f4b86..69f156833f 100644 --- a/src/detect-flowbits.c +++ b/src/detect-flowbits.c @@ -873,7 +873,7 @@ static int FlowBitsTestSig06(void) "Host: one.example.org\r\n" "\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); Signature *s = NULL; ThreadVars th_v; @@ -884,7 +884,6 @@ static int FlowBitsTestSig06(void) int result = 0; uint32_t idx = 0; - memset(p, 0, SIZE_OF_PACKET); memset(&th_v, 0, sizeof(th_v)); memset(&f, 0, sizeof(Flow)); memset(&flowvar, 0, sizeof(GenericVar)); @@ -947,7 +946,7 @@ static int FlowBitsTestSig07(void) "Host: one.example.org\r\n" "\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); Signature *s = NULL; ThreadVars th_v; @@ -958,7 +957,6 @@ static int FlowBitsTestSig07(void) int result = 0; uint32_t idx = 0; - memset(p, 0, SIZE_OF_PACKET); memset(&th_v, 0, sizeof(th_v)); memset(&f, 0, sizeof(Flow)); memset(&flowvar, 0, sizeof(GenericVar)); @@ -1023,7 +1021,7 @@ static int FlowBitsTestSig08(void) "Host: one.example.org\r\n" "\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Signature *s = NULL; @@ -1035,7 +1033,6 @@ static int FlowBitsTestSig08(void) int result = 0; uint32_t idx = 0; - memset(p, 0, SIZE_OF_PACKET); memset(&th_v, 0, sizeof(th_v)); memset(&f, 0, sizeof(Flow)); memset(&flowvar, 0, sizeof(GenericVar)); diff --git a/src/detect-fragbits.c b/src/detect-fragbits.c index 52181375fa..74f42fe0b0 100644 --- a/src/detect-fragbits.c +++ b/src/detect-fragbits.c @@ -465,7 +465,7 @@ static int FragBitsTestParse03 (void) 0x0b ,0xc0 ,0x9f ,0x00 ,0x01 ,0x00 ,0x01 ,0x00, 0x00 ,0x0e ,0x10 ,0x00 ,0x04 ,0x81 ,0x6f ,0x0b, 0x51}; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); ThreadVars tv; DecodeThreadVars dtv; @@ -475,7 +475,6 @@ static int FragBitsTestParse03 (void) SigMatch *sm = NULL; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ipv4h, 0, sizeof(IPV4Hdr)); dtv.app_tctx = AppLayerGetCtxThread(&tv); @@ -552,7 +551,7 @@ static int FragBitsTestParse04 (void) 0x0b ,0xc0 ,0x9f ,0x00 ,0x01 ,0x00 ,0x01 ,0x00, 0x00 ,0x0e ,0x10 ,0x00 ,0x04 ,0x81 ,0x6f ,0x0b, 0x51}; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); ThreadVars tv; DecodeThreadVars dtv; @@ -562,7 +561,6 @@ static int FragBitsTestParse04 (void) SigMatch *sm = NULL; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&ipv4h, 0, sizeof(IPV4Hdr)); dtv.app_tctx = AppLayerGetCtxThread(&tv); diff --git a/src/detect-fragoffset.c b/src/detect-fragoffset.c index b5d32aaaec..6d866bee45 100644 --- a/src/detect-fragoffset.c +++ b/src/detect-fragoffset.c @@ -377,7 +377,7 @@ static int DetectFragOffsetParseTest03 (void) static int DetectFragOffsetMatchTest01 (void) { int result = 0; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Signature *s = NULL; @@ -386,7 +386,6 @@ static int DetectFragOffsetMatchTest01 (void) DetectEngineThreadCtx *det_ctx = NULL; IPV4Hdr ip4h; - memset(p, 0, SIZE_OF_PACKET); memset(&ip4h, 0, sizeof(IPV4Hdr)); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&th_v, 0, sizeof(ThreadVars)); diff --git a/src/detect-ftpbounce.c b/src/detect-ftpbounce.c index 0779e803c8..3b6716ad05 100644 --- a/src/detect-ftpbounce.c +++ b/src/detect-ftpbounce.c @@ -433,7 +433,7 @@ static int DetectFtpbounceTestALMatch03(void) TcpSession ssn; Flow f; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Signature *s = NULL; @@ -442,7 +442,6 @@ static int DetectFtpbounceTestALMatch03(void) AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc(); memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); memset(&f, 0, sizeof(f)); memset(&ssn, 0, sizeof(ssn)); diff --git a/src/detect-hostbits.c b/src/detect-hostbits.c index 23eaf45155..eef3d85d3d 100644 --- a/src/detect-hostbits.c +++ b/src/detect-hostbits.c @@ -561,7 +561,6 @@ static int HostBitsTestSig01(void) DetectEngineCtx *de_ctx = NULL; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; @@ -655,7 +654,7 @@ static int HostBitsTestSig03(void) "Host: one.example.org\r\n" "\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Signature *s = NULL; @@ -742,7 +741,6 @@ static int HostBitsTestSig04(void) int idx = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; @@ -1066,7 +1064,6 @@ static int HostBitsTestSig07(void) Flow f; int result = 0; - memset(p, 0, SIZE_OF_PACKET); memset(&th_v, 0, sizeof(th_v)); memset(&f, 0, sizeof(Flow)); @@ -1142,7 +1139,6 @@ static int HostBitsTestSig08(void) DetectEngineCtx *de_ctx = NULL; Flow f; - memset(p, 0, SIZE_OF_PACKET); memset(&th_v, 0, sizeof(th_v)); memset(&f, 0, sizeof(Flow)); diff --git a/src/detect-ipopts.c b/src/detect-ipopts.c index 4c2c198f23..50b0618d42 100644 --- a/src/detect-ipopts.c +++ b/src/detect-ipopts.c @@ -259,7 +259,7 @@ static int IpOptsTestParse02 (void) */ static int IpOptsTestParse03 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -269,7 +269,6 @@ static int IpOptsTestParse03 (void) IPV4Hdr ip4h; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ip4h, 0, sizeof(IPV4Hdr)); p->ip4h = &ip4h; @@ -309,7 +308,7 @@ error: */ static int IpOptsTestParse04 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -319,7 +318,6 @@ static int IpOptsTestParse04 (void) IPV4Hdr ip4h; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ip4h, 0, sizeof(IPV4Hdr)); p->ip4h = &ip4h; diff --git a/src/detect-ipproto.c b/src/detect-ipproto.c index d0b591ada6..fc5f566ae2 100644 --- a/src/detect-ipproto.c +++ b/src/detect-ipproto.c @@ -1913,10 +1913,9 @@ static int DetectIPProtoTestSig2(void) 0x4a, 0xea, 0x7a, 0x8e, }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); DecodeThreadVars dtv; ThreadVars th_v; diff --git a/src/detect-parse.c b/src/detect-parse.c index 782ba840a2..ff3362b4eb 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -3602,7 +3602,7 @@ static int SigTestBidirec04 (void) 0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69, 0x76,0x65,0x0d,0x0a,0x0d,0x0a }; /* end rawpkt1_ether */ - p = SCMalloc(SIZE_OF_PACKET); + p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; DecodeThreadVars dtv; @@ -3610,7 +3610,6 @@ static int SigTestBidirec04 (void) DetectEngineThreadCtx *det_ctx; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); FlowInitConfig(FLOW_QUIET); DecodeEthernet(&th_v, &dtv, p, rawpkt1_ether, sizeof(rawpkt1_ether), NULL); diff --git a/src/detect-tcp-flags.c b/src/detect-tcp-flags.c index b07f6c4bf1..b91cd0d294 100644 --- a/src/detect-tcp-flags.c +++ b/src/detect-tcp-flags.c @@ -652,7 +652,7 @@ static int FlagsTestParse02 (void) */ static int FlagsTestParse03 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -663,7 +663,6 @@ static int FlagsTestParse03 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -707,7 +706,7 @@ error: */ static int FlagsTestParse04 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -718,7 +717,6 @@ static int FlagsTestParse04 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -763,7 +761,7 @@ error: */ static int FlagsTestParse05 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -774,7 +772,6 @@ static int FlagsTestParse05 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -819,7 +816,7 @@ error: */ static int FlagsTestParse06 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -830,7 +827,6 @@ static int FlagsTestParse06 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -874,7 +870,7 @@ error: */ static int FlagsTestParse07 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -885,7 +881,6 @@ static int FlagsTestParse07 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -930,7 +925,7 @@ error: */ static int FlagsTestParse08 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -941,7 +936,6 @@ static int FlagsTestParse08 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -985,7 +979,7 @@ error: */ static int FlagsTestParse09 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -996,7 +990,6 @@ static int FlagsTestParse09 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1040,7 +1033,7 @@ error: */ static int FlagsTestParse10 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1051,7 +1044,6 @@ static int FlagsTestParse10 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1095,7 +1087,7 @@ error: */ static int FlagsTestParse11 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1106,7 +1098,6 @@ static int FlagsTestParse11 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1151,7 +1142,7 @@ error: */ static int FlagsTestParse12 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1162,7 +1153,6 @@ static int FlagsTestParse12 (void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1238,7 +1228,7 @@ static int FlagsTestParse14(void) static int FlagsTestParse15(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1249,7 +1239,6 @@ static int FlagsTestParse15(void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1291,7 +1280,7 @@ error: static int FlagsTestParse16(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1302,7 +1291,6 @@ static int FlagsTestParse16(void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); @@ -1347,7 +1335,7 @@ error: */ static int FlagsTestParse17(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars tv; @@ -1358,7 +1346,6 @@ static int FlagsTestParse17(void) TCPHdr tcph; memset(&tv, 0, sizeof(ThreadVars)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(IPV4Hdr)); memset(&tcph, 0, sizeof(TCPHdr)); diff --git a/src/detect-xbits.c b/src/detect-xbits.c index 5735effade..e639f48576 100644 --- a/src/detect-xbits.c +++ b/src/detect-xbits.c @@ -456,7 +456,7 @@ static int XBitsTestSig01(void) "Host: one.example.org\r\n" "\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); Signature *s = NULL; ThreadVars th_v; @@ -464,7 +464,6 @@ static int XBitsTestSig01(void) DetectEngineCtx *de_ctx = NULL; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; diff --git a/src/stream-tcp.c b/src/stream-tcp.c index e9dfecfc0e..06f52519a1 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -6337,11 +6337,10 @@ void TcpSessionSetReassemblyDepth(TcpSession *ssn, uint32_t size) static int StreamTcpTest01 (void) { StreamTcpThread stt; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); FLOW_INITIALIZE(&f); p->flow = &f; @@ -6385,7 +6384,7 @@ end: static int StreamTcpTest02 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; @@ -6394,7 +6393,6 @@ static int StreamTcpTest02 (void) TCPHdr tcph; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -6471,14 +6469,13 @@ static int StreamTcpTest02 (void) static int StreamTcpTest03 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6547,14 +6544,13 @@ end: static int StreamTcpTest04 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6616,7 +6612,7 @@ end: static int StreamTcpTest05 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -6624,7 +6620,6 @@ static int StreamTcpTest05 (void) StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6716,7 +6711,7 @@ end: static int StreamTcpTest06 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -6724,7 +6719,6 @@ static int StreamTcpTest06 (void) ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6779,7 +6773,7 @@ end: static int StreamTcpTest07 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; @@ -6788,7 +6782,6 @@ static int StreamTcpTest07 (void) uint8_t payload[1] = {0x42}; PacketQueue pq; - memset(p, 0, SIZE_OF_PACKET); memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); @@ -6841,7 +6834,7 @@ static int StreamTcpTest07 (void) static int StreamTcpTest08 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; @@ -6849,7 +6842,6 @@ static int StreamTcpTest08 (void) TCPHdr tcph; uint8_t payload[1] = {0x42}; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6904,7 +6896,7 @@ static int StreamTcpTest08 (void) static int StreamTcpTest09 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; @@ -6912,7 +6904,6 @@ static int StreamTcpTest09 (void) TCPHdr tcph; uint8_t payload[1] = {0x42}; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -6975,14 +6966,13 @@ static int StreamTcpTest09 (void) static int StreamTcpTest10 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7054,14 +7044,13 @@ static int StreamTcpTest10 (void) static int StreamTcpTest11 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7134,7 +7123,7 @@ static int StreamTcpTest11 (void) static int StreamTcpTest12 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -7142,7 +7131,6 @@ static int StreamTcpTest12 (void) StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7230,7 +7218,7 @@ end: static int StreamTcpTest13 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -7238,7 +7226,6 @@ static int StreamTcpTest13 (void) StreamTcpThread stt; TCPHdr tcph; uint8_t payload[4]; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7430,7 +7417,7 @@ static const char *StreamTcpParseOSPolicy (char *conf_var_name) static int StreamTcpTest14 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -7445,7 +7432,6 @@ static int StreamTcpTest14 (void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -7600,14 +7586,13 @@ end: static int StreamTcp4WHSTest01 (void) { int ret = 0; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7682,14 +7667,13 @@ end: static int StreamTcp4WHSTest02 (void) { int ret = 0; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7753,13 +7737,12 @@ end: static int StreamTcp4WHSTest03 (void) { int ret = 0; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(unlikely(p == NULL)); Flow f; ThreadVars tv; StreamTcpThread stt; TCPHdr tcph; - memset(p, 0, SIZE_OF_PACKET); PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -7832,7 +7815,7 @@ end: static int StreamTcpTest15 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -7847,7 +7830,6 @@ static int StreamTcpTest15 (void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -7999,7 +7981,7 @@ end: static int StreamTcpTest16 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -8014,7 +7996,6 @@ static int StreamTcpTest16 (void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -8169,7 +8150,7 @@ end: static int StreamTcpTest17 (void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -8184,7 +8165,6 @@ static int StreamTcpTest17 (void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -8338,7 +8318,7 @@ static int StreamTcpTest18 (void) char os_policy_name[10] = "windows"; const char *ip_addr; TcpStream stream; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; @@ -8346,7 +8326,6 @@ static int StreamTcpTest18 (void) memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); @@ -8387,7 +8366,7 @@ static int StreamTcpTest19 (void) char os_policy_name[10] = "windows"; const char *ip_addr; TcpStream stream; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; @@ -8395,7 +8374,6 @@ static int StreamTcpTest19 (void) memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); @@ -8439,7 +8417,7 @@ static int StreamTcpTest20 (void) char os_policy_name[10] = "linux"; const char *ip_addr; TcpStream stream; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; @@ -8447,7 +8425,6 @@ static int StreamTcpTest20 (void) memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); @@ -8491,7 +8468,7 @@ static int StreamTcpTest21 (void) char os_policy_name[10] = "linux"; const char *ip_addr; TcpStream stream; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; @@ -8499,7 +8476,6 @@ static int StreamTcpTest21 (void) memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); @@ -8543,7 +8519,7 @@ static int StreamTcpTest22 (void) char os_policy_name[10] = "windows"; const char *ip_addr; TcpStream stream; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; @@ -8551,7 +8527,6 @@ static int StreamTcpTest22 (void) memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); - memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); @@ -8598,11 +8573,10 @@ static int StreamTcpTest23(void) ThreadVars tv; PacketQueue pq; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF(p == NULL); memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset(&f, 0, sizeof (Flow)); memset(&tcph, 0, sizeof (TCPHdr)); memset(&tv, 0, sizeof (ThreadVars)); @@ -8658,7 +8632,7 @@ static int StreamTcpTest24(void) { StreamTcpThread stt; TcpSession ssn; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF (p == NULL); Flow f; TCPHdr tcph; @@ -8671,7 +8645,6 @@ static int StreamTcpTest24(void) StreamTcpUTInit(&stt.ra_ctx); StreamTcpUTSetupSession(&ssn); - memset(p, 0, SIZE_OF_PACKET); memset(&f, 0, sizeof (Flow)); memset(&tcph, 0, sizeof (TCPHdr)); FLOW_INITIALIZE(&f); @@ -8726,7 +8699,7 @@ static int StreamTcpTest24(void) */ static int StreamTcpTest25(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -8738,7 +8711,6 @@ static int StreamTcpTest25(void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -8819,7 +8791,7 @@ end: */ static int StreamTcpTest26(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -8831,7 +8803,6 @@ static int StreamTcpTest26(void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -8913,7 +8884,7 @@ end: */ static int StreamTcpTest27(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -8925,7 +8896,6 @@ static int StreamTcpTest27(void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -9884,7 +9854,7 @@ end: */ static int StreamTcpTest37(void) { - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; Flow f; @@ -9896,7 +9866,6 @@ static int StreamTcpTest37(void) PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); - memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); @@ -10017,10 +9986,9 @@ static int StreamTcpTest38 (void) memset(&tcph, 0, sizeof (TCPHdr)); memset(&pq,0,sizeof(PacketQueue)); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); FLOW_INITIALIZE(&f); p->flow = &f; @@ -10172,10 +10140,9 @@ static int StreamTcpTest39 (void) memset(&tcph, 0, sizeof (TCPHdr)); memset(&pq,0,sizeof(PacketQueue)); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); FLOW_INITIALIZE(&f); p->flow = &f; @@ -10294,12 +10261,11 @@ static int StreamTcpTest42 (void) StreamTcpThread stt; TCPHdr tcph; PacketQueue pq; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); TcpSession *ssn; if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -10386,12 +10352,11 @@ static int StreamTcpTest43 (void) StreamTcpThread stt; TCPHdr tcph; PacketQueue pq; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); TcpSession *ssn; if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -10478,12 +10443,11 @@ static int StreamTcpTest44 (void) StreamTcpThread stt; TCPHdr tcph; PacketQueue pq; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); TcpSession *ssn; if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); @@ -10565,12 +10529,11 @@ static int StreamTcpTest45 (void) StreamTcpThread stt; TCPHdr tcph; PacketQueue pq; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); TcpSession *ssn; if (unlikely(p == NULL)) return 0; - memset(p, 0, SIZE_OF_PACKET); memset(&pq,0,sizeof(PacketQueue)); memset (&f, 0, sizeof(Flow)); diff --git a/src/tests/detect.c b/src/tests/detect.c index 81fc254cf7..c7cc6a34f6 100644 --- a/src/tests/detect.c +++ b/src/tests/detect.c @@ -943,7 +943,7 @@ static int SigTest15 (void) uint8_t *buf = (uint8_t *) "CONNECT 213.92.8.7:31204 HTTP/1.1"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars th_v; @@ -951,7 +951,6 @@ static int SigTest15 (void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; @@ -1102,7 +1101,7 @@ static int SigTest18 (void) uint8_t *buf = (uint8_t *) "220 (vsFTPd 2.0.5)\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars th_v; @@ -1110,7 +1109,6 @@ static int SigTest18 (void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; @@ -1155,7 +1153,7 @@ static int SigTest19 (void) uint8_t *buf = (uint8_t *) "220 (vsFTPd 2.0.5)\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars th_v; @@ -1163,7 +1161,6 @@ static int SigTest19 (void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->src.addr_data32[0] = UTHSetIPv4Address("192.168.0.1"); p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4"); @@ -1216,7 +1213,7 @@ static int SigTest20 (void) uint8_t *buf = (uint8_t *) "220 (vsFTPd 2.0.5)\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars th_v; @@ -1224,7 +1221,6 @@ static int SigTest20 (void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->src.addr_data32[0] = UTHSetIPv4Address("192.168.0.1"); p->dst.addr_data32[0] = UTHSetIPv4Address("1.2.3.4"); @@ -1513,10 +1509,10 @@ static int SigTest24IPV4Keyword(void) 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03, 0xc0, 0xa8, 0x01, 0x06}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -1530,8 +1526,6 @@ static int SigTest24IPV4Keyword(void) uint16_t buflen = strlen((char *)buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); PACKET_RESET_CHECKSUMS(p2); @@ -1617,10 +1611,10 @@ static int SigTest25NegativeIPV4Keyword(void) 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03, 0xc0, 0xa8, 0x01, 0x06}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -1634,8 +1628,6 @@ static int SigTest25NegativeIPV4Keyword(void) uint16_t buflen = strlen((char *)buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); PACKET_RESET_CHECKSUMS(p2); @@ -1727,11 +1719,11 @@ static int SigTest26TCPV4Keyword(void) 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73, 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -1741,8 +1733,6 @@ static int SigTest26TCPV4Keyword(void) DetectEngineThreadCtx *det_ctx = NULL; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PacketCopyData(p1, raw_ipv4, sizeof(raw_ipv4)); PacketCopyDataOffset(p1, GET_PKT_LEN(p1), valid_raw_tcp, sizeof(valid_raw_tcp)); @@ -1826,11 +1816,11 @@ static int SigTest26TCPV4AndNegativeIPV4Keyword(void) 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73, 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -1841,8 +1831,6 @@ static int SigTest26TCPV4AndNegativeIPV4Keyword(void) int result = 0; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PacketCopyData(p1, raw_ipv4, sizeof(raw_ipv4)); PacketCopyDataOffset(p1, GET_PKT_LEN(p1), valid_raw_tcp, sizeof(valid_raw_tcp)); @@ -1952,11 +1940,11 @@ static int SigTest26TCPV4AndIPV4Keyword(void) 0x19, 0x69, 0x81, 0x7e, 0xFF, 0xAA, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -1967,8 +1955,6 @@ static int SigTest26TCPV4AndIPV4Keyword(void) int result = 0; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PacketCopyData(p1, raw_ipv4, sizeof(raw_ipv4)); PacketCopyDataOffset(p1, GET_PKT_LEN(p1), valid_raw_tcp, sizeof(valid_raw_tcp)); @@ -2067,11 +2053,10 @@ static int SigTest27NegativeTCPV4Keyword(void) 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73, 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03}; - - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2081,8 +2066,6 @@ static int SigTest27NegativeTCPV4Keyword(void) int result = 0; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PacketCopyData(p1, raw_ipv4, sizeof(raw_ipv4)); PacketCopyDataOffset(p1, GET_PKT_LEN(p1), valid_raw_tcp, sizeof(valid_raw_tcp)); @@ -2194,10 +2177,10 @@ static int SigTest28TCPV6Keyword(void) 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a, 0x00, 0x01, 0x69, 0x28}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2207,8 +2190,6 @@ static int SigTest28TCPV6Keyword(void) int result = 0; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip6h = (IPV6Hdr *)(valid_raw_ipv6 + 14); @@ -2322,10 +2303,10 @@ static int SigTest29NegativeTCPV6Keyword(void) 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a, 0x00, 0x01, 0x69, 0x28}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2335,8 +2316,6 @@ static int SigTest29NegativeTCPV6Keyword(void) int result = 0; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip6h = (IPV6Hdr *)(valid_raw_ipv6 + 14); @@ -2445,9 +2424,9 @@ static int SigTest30UDPV4Keyword(void) 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0xc0, 0x27}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); FAIL_IF_NULL(p1); - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); FAIL_IF_NULL(p2); ThreadVars th_v; @@ -2457,8 +2436,6 @@ static int SigTest30UDPV4Keyword(void) "\r\n\r\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip4h = (IPV4Hdr *)raw_ipv4; @@ -2549,10 +2526,10 @@ static int SigTest31NegativeUDPV4Keyword(void) 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0xc0, 0x27}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2565,8 +2542,6 @@ static int SigTest31NegativeUDPV4Keyword(void) "\r\n\r\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip4h = (IPV4Hdr *)raw_ipv4; @@ -2666,9 +2641,9 @@ static int SigTest32UDPV6Keyword(void) 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0, 0x09, 0x01}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); FAIL_IF_NULL(p1); - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); FAIL_IF_NULL(p2); ThreadVars th_v; @@ -2678,8 +2653,6 @@ static int SigTest32UDPV6Keyword(void) "\r\n\r\n"; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip6h = (IPV6Hdr *)(valid_raw_ipv6 + 14); @@ -2763,10 +2736,10 @@ static int SigTest33NegativeUDPV6Keyword(void) 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0, 0x09, 0x01}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2779,8 +2752,6 @@ static int SigTest33NegativeUDPV6Keyword(void) "\r\n\r\n"; memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip6h = (IPV6Hdr *)(valid_raw_ipv6 + 14); @@ -2880,10 +2851,10 @@ static int SigTest34ICMPV4Keyword(void) 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -2897,8 +2868,6 @@ static int SigTest34ICMPV4Keyword(void) uint16_t buflen = strlen((char *)buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip4h = (IPV4Hdr *)(valid_raw_ipv4); @@ -3000,10 +2969,10 @@ static int SigTest35NegativeICMPV4Keyword(void) 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38}; - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - Packet *p2 = SCMalloc(SIZE_OF_PACKET); + Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; @@ -3017,8 +2986,6 @@ static int SigTest35NegativeICMPV4Keyword(void) uint16_t buflen = strlen((char *)buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); - memset(p2, 0, SIZE_OF_PACKET); PACKET_RESET_CHECKSUMS(p1); p1->ip4h = (IPV4Hdr *)(valid_raw_ipv4); @@ -3095,7 +3062,7 @@ end: static int SigTest38(void) { - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; ThreadVars th_v; @@ -3136,7 +3103,6 @@ static int SigTest38(void) uint16_t buflen = sizeof(buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); /* Copy raw data into packet */ if (PacketCopyData(p1, raw_eth, ethlen) == -1) { @@ -3226,7 +3192,7 @@ end: static int SigTest39(void) { - Packet *p1 = SCMalloc(SIZE_OF_PACKET); + Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; ThreadVars th_v; @@ -3267,7 +3233,6 @@ static int SigTest39(void) uint16_t buflen = sizeof(buf); memset(&th_v, 0, sizeof(ThreadVars)); - memset(p1, 0, SIZE_OF_PACKET); /* Copy raw data into packet */ if (PacketCopyData(p1, raw_eth, ethlen) == -1) { @@ -3402,7 +3367,7 @@ static int SigTest36ContentAndIsdataatKeywords01 (void) ,0x65,0x72,0x65,0x3c,0x2f,0x41,0x3e,0x2e,0x0d,0x0a,0x3c,0x2f,0x42,0x4f,0x44,0x59 ,0x3e,0x3c,0x2f,0x48,0x54,0x4d,0x4c,0x3e,0x0d,0x0a }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; DecodeThreadVars dtv; @@ -3410,7 +3375,6 @@ static int SigTest36ContentAndIsdataatKeywords01 (void) ThreadVars th_v; DetectEngineThreadCtx *det_ctx = NULL; - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&th_v, 0, sizeof(th_v)); @@ -3521,7 +3485,7 @@ static int SigTest37ContentAndIsdataatKeywords02 (void) ,0x65,0x72,0x65,0x3c,0x2f,0x41,0x3e,0x2e,0x0d,0x0a,0x3c,0x2f,0x42,0x4f,0x44,0x59 ,0x3e,0x3c,0x2f,0x48,0x54,0x4d,0x4c,0x3e,0x0d,0x0a }; - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; DecodeThreadVars dtv; @@ -3529,7 +3493,6 @@ static int SigTest37ContentAndIsdataatKeywords02 (void) ThreadVars th_v; DetectEngineThreadCtx *det_ctx = NULL; - memset(p, 0, SIZE_OF_PACKET); memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&th_v, 0, sizeof(th_v)); @@ -3612,7 +3575,7 @@ static int SigTest40NoPacketInspection01(void) uint8_t *buf = (uint8_t *) "220 (vsFTPd 2.0.5)\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); TCPHdr tcphdr; if (unlikely(p == NULL)) return 0; @@ -3623,7 +3586,6 @@ static int SigTest40NoPacketInspection01(void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); memset(&pq, 0, sizeof(pq)); memset(&f, 0, sizeof(f)); memset(&tcphdr, 0, sizeof(tcphdr)); @@ -3691,9 +3653,8 @@ static int SigTest40NoPayloadInspection02(void) ThreadVars th_v; memset(&th_v, 0, sizeof(th_v)); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); FAIL_IF_NULL(p); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; @@ -3734,7 +3695,7 @@ static int SigTestMemory01 (void) "Host: two.example.org\r\n" "\r\n\r\n"; uint16_t buflen = strlen((char *)buf); - Packet *p = SCMalloc(SIZE_OF_PACKET); + Packet *p = PacketGetFromAlloc(); if (unlikely(p == NULL)) return 0; ThreadVars th_v; @@ -3742,7 +3703,6 @@ static int SigTestMemory01 (void) int result = 0; memset(&th_v, 0, sizeof(th_v)); - memset(p, 0, SIZE_OF_PACKET); p->src.family = AF_INET; p->dst.family = AF_INET; p->payload = buf; @@ -4276,10 +4236,9 @@ static int SigTestWithin01 (void) DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); /* packet 1 */ - p1 = SCMalloc(SIZE_OF_PACKET); + p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; - memset(p1, 0, SIZE_OF_PACKET); DecodeEthernet(&th_v, &dtv, p1, rawpkt1, sizeof(rawpkt1), NULL); SigMatchSignatures(&th_v, de_ctx, det_ctx, p1); if (!(PacketAlertCheck(p1, 556))) { @@ -4288,10 +4247,9 @@ static int SigTestWithin01 (void) } /* packet 2 */ - p2 = SCMalloc(SIZE_OF_PACKET); + p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) return 0; - memset(p2, 0, SIZE_OF_PACKET); DecodeEthernet(&th_v, &dtv, p2, rawpkt2, sizeof(rawpkt2), NULL); SigMatchSignatures(&th_v, de_ctx, det_ctx, p2); if (!(PacketAlertCheck(p2, 556))) { @@ -4300,10 +4258,9 @@ static int SigTestWithin01 (void) } /* packet 3 */ - p3 = SCMalloc(SIZE_OF_PACKET); + p3 = PacketGetFromAlloc(); if (unlikely(p3 == NULL)) return 0; - memset(p3, 0, SIZE_OF_PACKET); DecodeEthernet(&th_v, &dtv, p3, rawpkt3, sizeof(rawpkt3), NULL); SigMatchSignatures(&th_v, de_ctx, det_ctx, p3); if (!(PacketAlertCheck(p3, 556))) { @@ -4312,10 +4269,9 @@ static int SigTestWithin01 (void) } /* packet 4 */ - p4 = SCMalloc(SIZE_OF_PACKET); + p4 = PacketGetFromAlloc(); if (unlikely(p4 == NULL)) return 0; - memset(p4, 0, SIZE_OF_PACKET); DecodeEthernet(&th_v, &dtv, p4, rawpkt4, sizeof(rawpkt4), NULL); SigMatchSignatures(&th_v, de_ctx, det_ctx, p4); if (!(PacketAlertCheck(p4, 556))) {