]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
packet pool: make pending pool use more robust 1286/head
authorVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:22:37 +0000 (10:22 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:22:37 +0000 (10:22 +0100)
Don't leave pointers dangling.

src/tmqh-packetpool.c

index bd8761e25aa1c551a795f1a642a773d6a5d35524..6ef25c7d326f1c7f2da1603e6b9d6b2019996b5e 100644 (file)
@@ -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;