]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: initialize the threadpool job iterator before using
authorSasha Levin <levinsasha928@gmail.com>
Mon, 17 Sep 2012 08:03:33 +0000 (10:03 +0200)
committerPekka Enberg <penberg@kernel.org>
Tue, 18 Sep 2012 07:17:47 +0000 (10:17 +0300)
This would fix a bug where the exit function of the threadpool would hang
if no jobs were processed yet and a request to exit was received.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/util/threadpool.c

index 6c7566de9d82adcc42267665f527e0c877cf9c8a..9b91995b5f51e03346a44f8908246610233b5813 100644 (file)
@@ -78,7 +78,7 @@ static void *thread_pool__threadfunc(void *param)
        pthread_cleanup_push(thread_pool__threadfunc_cleanup, NULL);
 
        while (running) {
-               struct thread_pool__job *curjob;
+               struct thread_pool__job *curjob = NULL;
 
                mutex_lock(&job_mutex);
                while (running && (curjob = thread_pool__job_pop_locked()) == NULL)