|
@@ -363,14 +363,14 @@ static int mod_init(void)
|
|
|
/*verify table versions */
|
|
|
if((db_check_table_version(&pa_dbf, pa_db, &presentity_table, P_TABLE_VERSION) < 0) ||
|
|
|
(db_check_table_version(&pa_dbf, pa_db, &watchers_table, S_TABLE_VERSION) < 0)) {
|
|
|
- LM_ERR("error during table version check\n");
|
|
|
- return -1;
|
|
|
+ DB_TABLE_VERSION_ERROR(presentity_table);
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
|
|
|
if(subs_dbmode != NO_DB &&
|
|
|
db_check_table_version(&pa_dbf, pa_db, &active_watchers_table, ACTWATCH_TABLE_VERSION) < 0) {
|
|
|
- LM_ERR("wrong table version for %s\n", active_watchers_table.s);
|
|
|
- return -1;
|
|
|
+ DB_TABLE_VERSION_ERROR(active_watchers_table);
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
|
|
|
if(subs_dbmode != DB_ONLY) {
|
|
@@ -383,12 +383,12 @@ static int mod_init(void)
|
|
|
if(subs_htable== NULL)
|
|
|
{
|
|
|
LM_ERR(" initializing subscribe hash table\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
if(restore_db_subs()< 0)
|
|
|
{
|
|
|
LM_ERR("restoring subscribe info from database\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -402,13 +402,13 @@ static int mod_init(void)
|
|
|
if(pres_htable== NULL)
|
|
|
{
|
|
|
LM_ERR("initializing presentity hash table\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
|
|
|
if(pres_htable_restore()< 0)
|
|
|
{
|
|
|
LM_ERR("filling in presentity hash table from database\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -436,7 +436,7 @@ static int mod_init(void)
|
|
|
if ((pres_notifier_id = shm_malloc(sizeof(int) * pres_notifier_processes)) == NULL)
|
|
|
{
|
|
|
LM_ERR("allocating shared memory\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
|
|
|
register_basic_timers(pres_notifier_processes);
|
|
@@ -453,7 +453,7 @@ static int mod_init(void)
|
|
|
}
|
|
|
else {
|
|
|
LM_ERR("invalid log facility configured\n");
|
|
|
- return -1;
|
|
|
+ goto dberror;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@@ -476,6 +476,11 @@ static int mod_init(void)
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
+
|
|
|
+dberror:
|
|
|
+ pa_dbf.close(pa_db);
|
|
|
+ pa_db = NULL;
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
/**
|