From: Victor Julien Date: Tue, 25 Oct 2022 07:07:58 +0000 (+0200) Subject: doc/devguide: update packet (de)alloc in unittests X-Git-Tag: suricata-7.0.0-beta1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f6c014f706f85242f7511a2c689f5594cc4439e;p=thirdparty%2Fsuricata.git doc/devguide: update packet (de)alloc in unittests --- diff --git a/doc/userguide/devguide/codebase/testing.rst b/doc/userguide/devguide/codebase/testing.rst index ac844c22a2..c712e90a99 100644 --- a/doc/userguide/devguide/codebase/testing.rst +++ b/doc/userguide/devguide/codebase/testing.rst @@ -75,20 +75,19 @@ From the C side, ``decode-ethernet.c`` offers an good example: 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)); FAIL_IF_NOT(ENGINE_ISSET_EVENT(p, DCE_PKT_TOO_SMALL)); - SCFree(p); + PacketFree(p); PASS; }