mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Fix some potential memory leaks in the thread pool code.
This commit is contained in:
committed by
Nick Mathewson
parent
2200d9d3f8
commit
3b3b447f75
@@ -255,6 +255,7 @@ workerthread_new(void *state, threadpool_t *pool, replyqueue_t *replyqueue)
|
||||
|
||||
if (spawn_func(worker_thread_main, thr) < 0) {
|
||||
log_err(LD_GENERAL, "Can't launch worker thread.");
|
||||
tor_free(thr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -382,6 +383,7 @@ threadpool_start_threads(threadpool_t *pool, int n)
|
||||
workerthread_t *thr = workerthread_new(state, pool, pool->reply_queue);
|
||||
|
||||
if (!thr) {
|
||||
pool->free_thread_state_fn(state);
|
||||
tor_mutex_release(&pool->lock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user