From 6e174128c832c7f3a50186d3e17429ade4ce06aa Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 6 Jan 2015 10:20:40 +0100 Subject: [PATCH] packet pool: memory fixes for non-TLS 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tmqh-packetpool.c b/src/tmqh-packetpool.c index ef63ec4e83..bd8761e25a 100644 --- a/src/tmqh-packetpool.c +++ b/src/tmqh-packetpool.c @@ -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);