From 1f5216c763ac43c8525d2f869b5d8c6e2ec7d55f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 18 May 2017 09:23:32 +0200 Subject: [PATCH] src/daemon/utils_cache.c: Read time *after* acquiring the lock. Fixes: #1193 --- src/daemon/utils_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index fe0e083e..a23aef88 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -222,8 +222,6 @@ int uc_init(void) { } /* int uc_init */ int uc_check_timeout(void) { - cdtime_t now = cdtime(); - struct { char *key; cdtime_t time; @@ -232,6 +230,7 @@ int uc_check_timeout(void) { size_t expired_num = 0; pthread_mutex_lock(&cache_lock); + cdtime_t now = cdtime(); /* Build a list of entries to be flushed */ c_avl_iterator_t *iter = c_avl_get_iterator(cache_tree); -- 2.30.2