From: Anthony Minessale Date: Thu, 9 Dec 2010 02:38:16 +0000 (-0600) Subject: FS-2910 X-Git-Tag: v1.2-rc1~236^2~5^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5aba96e382793c2c4440a658f7c1797b6c8c2809;p=thirdparty%2Ffreeswitch.git FS-2910 --- diff --git a/src/switch_odbc.c b/src/switch_odbc.c index a1c476e4a1..5a88ba7690 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -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;