From 21ddc7367323af67792ef0adbb33711456aa53f3 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 24 Jun 2012 09:40:48 -0400 Subject: [PATCH] Unlock the rcfile mutex upon exit. --- src/pwmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pwmd.c b/src/pwmd.c index a5065501..b29724fd 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -136,6 +136,7 @@ static void *reload_rcfile_thread(void *arg) #endif pthread_setspecific(thread_name_key, g_strdup(__FUNCTION__)); MUTEX_LOCK(&rcfile_mutex); + pthread_cleanup_push(cleanup_mutex_cb, &rcfile_mutex); for (;;) { gboolean b = disable_list_and_dump; @@ -165,6 +166,7 @@ static void *reload_rcfile_thread(void *arg) #endif } + pthread_cleanup_pop(1); return NULL; } @@ -2165,13 +2167,14 @@ do_exit: #ifdef WITH_GNUTLS gnutls_global_deinit(); #endif - if (keyfileh) - g_key_file_free(keyfileh); - pthread_cancel(rcfile_tid); pthread_join(rcfile_tid, NULL); pthread_cond_destroy(&rcfile_cond); pthread_mutex_destroy(&rcfile_mutex); + + if (keyfileh) + g_key_file_free(keyfileh); + g_free(rcfile); xmlCleanupParser(); xmlCleanupGlobals(); -- 2.11.4.GIT