inliniac/suricata — pull request #424 by ken-tilera (2013-07-09 13:40:19+00:00)
Title: Replace ReleaseData function pointer on Packet Structure with ReleasePac...

...ket.

To allow handling Packets allocated by different methods, a new function
pointer is added to the Packet structure that is called to release any
Packet. The ReleaseData function pointer usage, only currently in AF Packet,
is replaced with an AFP specific ReleasePacket function that first calls
the AFP specific ReleaseData function and then releases the Packet structure.

Two new functions are defined for releasing packets in the default case:
1) PacketFree() - To release a packet alloced with SCMalloc()
2) PacketPoolReturnPacket() - For packets allocated from the Packet Pool.

Having these two functions removes the need to check the PKT_ALLOC flag
when releasing a packet. The PKT_ALLOC flag is still set and is needed when
AF Packet releases a packet, since it replaces the ReleasePacket function
pointer with its own function.