decode: release refs from PacketFree

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

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

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

Loading…
Cancel
Save