From 623c2e78fdd7ed952e52aca92b240109019aad04 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 6 Jan 2015 10:22:37 +0100 Subject: [PATCH] packet pool: make pending pool use more robust Don't leave pointers dangling. --- src/tmqh-packetpool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tmqh-packetpool.c b/src/tmqh-packetpool.c index bd8761e25a..6ef25c7d32 100644 --- a/src/tmqh-packetpool.c +++ b/src/tmqh-packetpool.c @@ -254,6 +254,9 @@ void PacketPoolReturnPacket(Packet *p) SCMutexUnlock(&pool->return_stack.mutex); /* Clear the list of pending packets to return. */ my_pool->pending_pool = NULL; + my_pool->pending_head = NULL; + my_pool->pending_tail = NULL; + my_pool->pending_count = 0; } } else { /* Push onto return stack for this pool */ @@ -297,7 +300,7 @@ void PacketPoolDestroy(void) { Packet *p = NULL; PktPool *my_pool = GetThreadPacketPool(); - if (my_pool && my_pool->pending_head != NULL) { + if (my_pool && my_pool->pending_pool != NULL) { p = my_pool->pending_head; while (p) { Packet *next_p = p->next; -- 2.47.2