Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: oisf/src/suricata.c
===================================================================
--- oisf.orig/src/suricata.c
+++ oisf/src/suricata.c
@@ -330,17 +330,20 @@ static void GlobalInits(void)
 
     /* Initialize trans_q[] and data_queues[] */
     for (q = 0; q < NUM_QUEUES; q++) {
-		trans_q[q] = calloc(1, sizeof(PacketQueue));
-		if (trans_q[q] == NULL) {
-			r = ENOMEM;
+		size_t align_size = ALIGN(sizeof(PacketQueue), CLS);
+
+		r = posix_memalign((void **)&trans_q[q], align_size,
+						   sizeof(PacketQueue));
+		if (r != 0)
 			break;
-		}
+		memset(trans_q[q], 0, sizeof(PacketQueue));
 
-		data_queues[q] = calloc(1, sizeof(SCDQDataQueue));
-		if (data_queues[q] = NULL) {
-			r = ENOMEM;
+		align_size = ALIGN(sizeof(SCDQDataQueue), CLS);
+		r = posix_memalign((void **)&data_queues[q], align_size,
+						   sizeof(SCDQDataQueue));
+		if (r != 0)
 			break;
-		}
+		memset(data_queues[q], 0, sizeof(SCDQDataQueue));
 
         r |= SCMutexInit(&trans_q[q]->mutex_q, NULL);
         r |= SCCondInit(&trans_q[q]->cond_q, NULL);
Index: oisf/src/suricata-common.h
===================================================================
--- oisf.orig/src/suricata-common.h
+++ oisf/src/suricata-common.h
@@ -216,6 +216,9 @@
 
 #define __ALIGNED(a)		__attribute__((__aligned__(a)))
 
+#define ALIGN(x, a)			(((x) + ((a) - 1)) & ~((a) - 1))
+#define IS_ALIGNED(p, a)	(((unsigned long)(p) & ((a) - 1)) == 0)
+
 /** type for the internal signature id. Since it's used in the matching engine
  *  extensively keeping this as small as possible reduces the overall memory
  *  footprint of the engine. Set to uint32_t if the engine needs to support


