if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
- return;
+
+ goto end;
}
switch_cache_db_persistant_execute_trans_full(dbh, sql, 1,
switch_cache_db_release_db_handle(&dbh);
+ end:
+
if (mutex) {
switch_mutex_unlock(mutex);
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+
+ if (mutex) {
+ switch_mutex_unlock(mutex);
+ }
+
return;
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+
+ if (mutex) {
+ switch_mutex_unlock(mutex);
+ }
+
return ret;
}
if (!(dbh = sofia_glue_get_db_handle(profile))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+
+ if (mutex) {
+ switch_mutex_unlock(mutex);
+ }
+
return NULL;
}