Although we were initializing worker threads during pool creating,
we missed this during virThreadPoolSendJob. This bug led to segmenation
fault as worker thread free() given argument.
void *jobData)
{
virThreadPoolJobPtr job;
+ struct virThreadPoolWorkerData *data = NULL;
virMutexLock(&pool->mutex);
if (pool->quit)
goto error;
}
+ if (VIR_ALLOC(data) < 0) {
+ pool->nWorkers--;
+ virReportOOMError();
+ goto error;
+ }
+
+ data->pool = pool;
+ data->cond = &pool->cond;
+
if (virThreadCreate(&pool->workers[pool->nWorkers - 1],
true,
virThreadPoolWorker,
- pool) < 0) {
+ data) < 0) {
+ VIR_FREE(data);
pool->nWorkers--;
goto error;
}