aboutsummaryrefslogtreecommitdiff
path: root/src/common/workqueue.c
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2015-07-07 10:17:32 +0200
committerNick Mathewson <nickm@torproject.org>2015-07-21 13:57:53 -0400
commit3b3b447f75772cc5bbfb48a9e951482dca3c8c0d (patch)
tree124f0d99ff33ae70b041330a1d9a3dd8a41009f0 /src/common/workqueue.c
parent2200d9d3f8b3830dff4c496d684147008bd38ace (diff)
downloadtor-3b3b447f75772cc5bbfb48a9e951482dca3c8c0d.tar.gz
tor-3b3b447f75772cc5bbfb48a9e951482dca3c8c0d.zip
Fix some potential memory leaks in the thread pool code.
Diffstat (limited to 'src/common/workqueue.c')
-rw-r--r--src/common/workqueue.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/workqueue.c b/src/common/workqueue.c
index ed896d78d0..3f9a063e11 100644
--- a/src/common/workqueue.c
+++ b/src/common/workqueue.c
@@ -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;
}