From ccefb8665119b448f650e8aa2b0c79b8d657bc1d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 10 Jul 2018 13:46:17 +0100 Subject: [PATCH] [Fix] Fix descriptors leak in sqlite3 locking code --- src/libutil/sqlite_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index d4c5e9e20..b1e33cb64 100644 --- a/src/libutil/sqlite_utils.c +++ b/src/libutil/sqlite_utils.c @@ -261,6 +261,8 @@ rspamd_sqlite3_wait (rspamd_mempool_t *pool, const gchar *lock) } } + close (fd); + if (nanosleep (&sleep_ts, NULL) == -1 && errno != EINTR) { msg_err_pool_check ("cannot sleep open lock file %s: %s", lock, strerror (errno)); @@ -358,8 +360,6 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const has_lock = TRUE; } - sqlite3_enable_shared_cache (1); - if ((rc = sqlite3_open_v2 (path, &sqlite, flags, NULL)) != SQLITE_OK) { #if SQLITE_VERSION_NUMBER >= 3008000 -- 2.39.5