diff --git a/modules/permissions/trusted.c b/modules/permissions/trusted.c index db20e8f9813..f42c09634ce 100644 --- a/modules/permissions/trusted.c +++ b/modules/permissions/trusted.c @@ -43,9 +43,9 @@ #define TABLE_VERSION 5 -struct trusted_list ***hash_table; /* Pointer to current hash table pointer */ -struct trusted_list **hash_table_1; /* Pointer to hash table 1 */ -struct trusted_list **hash_table_2; /* Pointer to hash table 2 */ +struct trusted_list ***hash_table = 0; /* Pointer to current hash table pointer */ +struct trusted_list **hash_table_1 = 0; /* Pointer to hash table 1 */ +struct trusted_list **hash_table_2 = 0; /* Pointer to hash table 2 */ static db1_con_t* db_handle = 0; @@ -69,16 +69,21 @@ int reload_trusted_table(void) char *pattern, *tag; - cols[0] = &source_col; - cols[1] = &proto_col; - cols[2] = &from_col; - cols[3] = &tag_col; + if (hash_table == 0) { + LM_ERR("in-memory hash table not initialized\n"); + return -1; + } if (db_handle == 0) { LM_ERR("no connection to database\n"); return -1; } + cols[0] = &source_col; + cols[1] = &proto_col; + cols[2] = &from_col; + cols[3] = &tag_col; + if (perm_dbf.use_table(db_handle, &trusted_table) < 0) { LM_ERR("failed to use trusted table\n"); return -1;