]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3127 --resolve please reopen if not fixed
authorJeff Lenk <jeff@jefflenk.com>
Sat, 6 Jul 2013 17:52:21 +0000 (12:52 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Sat, 6 Jul 2013 17:52:21 +0000 (12:52 -0500)
src/mod/applications/mod_callcenter/mod_callcenter.c

index c758147078ffb36f99e446ffee5a950c6dcc8f67..9f74d2f9ccf8e37725396e46490c406965ae9665 100644 (file)
@@ -562,27 +562,28 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch
 
        switch_cache_db_handle_t *dbh = NULL;
 
-       if (!(dbh = cc_get_db_handle())) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
-               return NULL;
-       }
-
        if (mutex) {
                switch_mutex_lock(mutex);
        } else {
                switch_mutex_lock(globals.mutex);
        }
 
+       if (!(dbh = cc_get_db_handle())) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+               goto end;
+       }
+
        ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL);
 
+end:
+       switch_cache_db_release_db_handle(&dbh);
+
        if (mutex) {
                switch_mutex_unlock(mutex);
        } else {
                switch_mutex_unlock(globals.mutex);
        }
 
-       switch_cache_db_release_db_handle(&dbh);
-
        return ret;
 }