mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Check thread count for negative; realloc->reallocarray
CID 1268069
This commit is contained in:
parent
7620c613e8
commit
0b46b08225
@ -363,10 +363,14 @@ threadpool_queue_update(threadpool_t *pool,
|
||||
static int
|
||||
threadpool_start_threads(threadpool_t *pool, int n)
|
||||
{
|
||||
if (n < 0)
|
||||
return -1;
|
||||
|
||||
tor_mutex_acquire(&pool->lock);
|
||||
|
||||
if (pool->n_threads < n)
|
||||
pool->threads = tor_realloc(pool->threads, sizeof(workerthread_t*)*n);
|
||||
pool->threads = tor_reallocarray(pool->threads,
|
||||
sizeof(workerthread_t*), n);
|
||||
|
||||
while (pool->n_threads < n) {
|
||||
void *state = pool->new_thread_state_fn(pool->new_thread_state_arg);
|
||||
|
Loading…
Reference in New Issue
Block a user