decode: release refs from PacketFree

Mostly helps unittests.
pull/7067/head
Victor Julien 3 years ago
parent 49a36bb323
commit f07d5b2d89

@ -856,17 +856,18 @@ void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s);
/**
* \brief Cleanup a packet so that we can free it. No memset needed..
*/
#define PACKET_DESTRUCTOR(p) do { \
if ((p)->pktvar != NULL) { \
PktVarFree((p)->pktvar); \
} \
PACKET_FREE_EXTDATA((p)); \
SCMutexDestroy(&(p)->tunnel_mutex); \
AppLayerDecoderEventsFreeEvents(&(p)->app_layer_events); \
PACKET_PROFILING_RESET((p)); \
#define PACKET_DESTRUCTOR(p) \
do { \
PACKET_RELEASE_REFS((p)); \
if ((p)->pktvar != NULL) { \
PktVarFree((p)->pktvar); \
} \
PACKET_FREE_EXTDATA((p)); \
SCMutexDestroy(&(p)->tunnel_mutex); \
AppLayerDecoderEventsFreeEvents(&(p)->app_layer_events); \
PACKET_PROFILING_RESET((p)); \
} while (0)
/* macro's for setting the action
* handle the case of a root packet
* for tunnels */

@ -225,14 +225,14 @@ Packet *PacketPoolGetPacket(void)
void PacketPoolReturnPacket(Packet *p)
{
PktPool *my_pool = GetThreadPacketPool();
PACKET_RELEASE_REFS(p);
PktPool *pool = p->pool;
if (pool == NULL) {
PacketFree(p);
return;
}
PACKET_RELEASE_REFS(p);
#ifdef DEBUG_VALIDATION
BUG_ON(pool->initialized == 0);
BUG_ON(pool->destroyed == 1);

Loading…
Cancel
Save