]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2910
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Dec 2010 02:38:16 +0000 (20:38 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Dec 2010 02:39:28 +0000 (20:39 -0600)
src/switch_odbc.c

index a1c476e4a142dd31b5ef081fa85aa5d5d357ae78..5a88ba76901ae6307140df52328a9626982ecac8 100644 (file)
@@ -160,11 +160,6 @@ static int db_is_up(switch_odbc_handle_t *handle)
                strcpy((char *) sql, "select 1");
        }
 
-       if (stmt) {
-               SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-               stmt = NULL;
-       }
-
        if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) {
                code = __LINE__;
                goto error;
@@ -229,6 +224,11 @@ static int db_is_up(switch_odbc_handle_t *handle)
                goto done;
        }
 
+       if (stmt) {
+               SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+               stmt = NULL;
+       }
+
        switch_safe_free(err_str);
        switch_yield(1000000);
        goto top;