From: Vsevolod Stakhov Date: Tue, 10 Jul 2018 12:46:17 +0000 (+0100) Subject: [Fix] Fix descriptors leak in sqlite3 locking code X-Git-Tag: 1.7.8~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ccefb8665119b448f650e8aa2b0c79b8d657bc1d;p=rspamd.git [Fix] Fix descriptors leak in sqlite3 locking code --- 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