In unix socket mode, suricata was doing multiple init of the
structure. This was not needed and caused a memory leak in
mutex creation.
};
+int thread_affinity_init_done = 0;
+
/**
* \brief find affinity by its name
* \retval a pointer to the affinity or NULL if not found
for (j = 0; j < ncpu; j++) {
CPU_SET(j, cs);
}
- SCMutexInit(&thread_affinity[i].taf_mutex, NULL);
+ SCMutexInit(&thread_affinity[i].taf_mutex, NULL);
}
return;
}
ConfNode *root = ConfGetNode("threading.cpu-affinity");
ConfNode *affinity;
- AffinitySetupInit();
+ if (thread_affinity_init_done == 0) {
+ AffinitySetupInit();
+ thread_affinity_init_done = 1;
+ }
SCLogDebug("Load affinity from config\n");
if (root == NULL) {