From 23bcac20735540dadca262a6801956ba0c9cfd40 Mon Sep 17 00:00:00 2001 From: Vlad Patrascu Date: Fri, 27 Nov 2020 22:41:01 +0200 Subject: [PATCH] sql_cacher: abort startup if DB connections/queries tests fail (cherry picked from commit 2ad1e1590787c19274c2dfd2893b7fafa1e1a31c) --- modules/sql_cacher/sql_cacher.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/sql_cacher/sql_cacher.c b/modules/sql_cacher/sql_cacher.c index 328b7af446c..5b0c3a84775 100644 --- a/modules/sql_cacher/sql_cacher.c +++ b/modules/sql_cacher/sql_cacher.c @@ -1152,7 +1152,7 @@ static void cache_init_load(int sender, void *param) static int mod_init(void) { - cache_entry_t *c_entry, *c_prev = NULL, *c_tmp; + cache_entry_t *c_entry, *c_prev = NULL; db_handlers_t *db_hdls; char use_timer = 0; @@ -1195,14 +1195,7 @@ static int mod_init(void) while (c_entry) { if ((db_hdls = db_init_test_conn(c_entry)) == NULL) { LM_ERR("Failed to validate db conns for cache entry\n"); - if (c_prev) - c_prev->next = c_entry->next; - else - *entry_list = c_entry->next; - c_tmp = c_entry; - c_entry = c_entry->next; - free_c_entry(c_tmp); - continue; + return -1; } if (!c_entry->on_demand) {