]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
packet pool: memory fixes for non-TLS
authorVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:20:40 +0000 (10:20 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:20:40 +0000 (10:20 +0100)
If the posix TLS implementation is used, the packet pool is memset to
0 before use.

Also use proper 'free' function.

src/tmqh-packetpool.c

index ef63ec4e83cd1abdf3d445f975a224a865f549fe..bd8761e25aa1c551a795f1a642a773d6a5d35524 100644 (file)
@@ -66,7 +66,7 @@ static int pkt_pool_thread_key_initialized = 0;
 
 static void PktPoolThreadDestroy(void * buf)
 {
-    free(buf);
+    SCFreeAligned(buf);
 }
 
 static void TmqhPacketPoolInit(void)
@@ -101,6 +101,8 @@ static PktPool *ThreadPacketPoolCreate(void)
         SCLogError(SC_ERR_MEM_ALLOC, "malloc failed");
         exit(EXIT_FAILURE);
     }
+    memset(pool,0x0,sizeof(*pool));
+
     int r = pthread_setspecific(pkt_pool_thread_key, pool);
     if (r != 0) {
         SCLogError(SC_ERR_MEM_ALLOC, "pthread_setspecific failed with %d", r);