Hi Victor,

You are correct, I missed checking in my change to decode.c to clear the PKT_ALLOC flag in PacketPoolStorePacket(). I have added that change to the same branch.

Regards,
-Ken

From: Victor Julien [mailto:notifications@github.com]
Sent: Saturday, May 18, 2013 7:36 AM
To: inliniac/suricata
Cc: Kenneth Steele
Subject: Re: [suricata] Using PacketGetFromAlloc() in place of SCMalloc() (#369)


In src/tmqh-packetpool.c:

> @@ -116,15 +116,11 @@ void PacketPoolInit(intmax_t max_pending_packets) {

>      SCLogDebug("preallocating packets... packet size %" PRIuMAX "", (uintmax_t)SIZE_OF_PACKET);

>      int i = 0;

>      for (i = 0; i < max_pending_packets; i++) {

> -        /* XXX pkt alloc function */

> -        Packet *p = SCMalloc(SIZE_OF_PACKET);

> +        Packet *p = PacketGetFromAlloc();

By using PacketGetFromAlloc our pool gets filled with packets with a PKT_ALLOC flag. This means they'll get freed instead of returned to the pool after use.

In PacketGetFromAlloc:
p->flags |= PKT_ALLOC;

—
Reply to this email directly or view it on GitHub<https://github.com/inliniac/suricata/pull/369/files#r4287867>.