@@ -55,6 +55,10 @@ int v9fs_init_worker_threads(void)
V9fsThPool *p = &v9fs_pool;
sigset_t set, oldset;
+ if (p->pool) {
+ return 0;
+ }
+
sigfillset(&set);
/* Leave signal handling to the iothread. */
pthread_sigmask(SIG_SETMASK, &set, &oldset);
@@ -66,10 +70,7 @@ int v9fs_init_worker_threads(void)
}
p->completed = g_async_queue_new();
if (!p->completed) {
- /*
- * We are going to terminate.
- * So don't worry about cleanup
- */
+ g_thread_pool_free(p->pool, TRUE, TRUE);
ret = -1;
goto err_out;
}
The v9fs thread pool is a singleton, shared by all virtio-9p devices. The current code leaks underlying glib pointers each time a new virtio-9p device gets realized. Let's fix that ! While we're here, we also fix the trivial error path when memory allocation is failing. Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> --- hw/9pfs/virtio-9p-coth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)