ODBC add description for translate servername with gbk

Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/0d35111c
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/0d35111c
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/0d35111c

Branch: refs/heads/master
Commit: 0d35111c08161646c908225a211b30f2cfc97159
Parents: c914a3e
Author: Weixin-Xu <[email protected]>
Authored: Fri Nov 30 09:58:39 2018 +0800
Committer: Weixin-Xu <[email protected]>
Committed: Fri Nov 30 09:58:39 2018 +0800

----------------------------------------------------------------------
 win-odbc64/security_dll/native/source/secpwd.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/0d35111c/win-odbc64/security_dll/native/source/secpwd.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/security_dll/native/source/secpwd.cpp 
b/win-odbc64/security_dll/native/source/secpwd.cpp
index c2bd427..981c8ab 100644
--- a/win-odbc64/security_dll/native/source/secpwd.cpp
+++ b/win-odbc64/security_dll/native/source/secpwd.cpp
@@ -221,19 +221,21 @@ SecPwd::SecPwd(const char *dir, const char* fileName,
     if(stat(certDir,&st) != 0)
         throw SecurityException(DIR_NOTFOUND, (char *)certDir);
 
-    if (lcid == 0x804) // if local charset is not utf8
+    if (lcid == 0x804) // if local charset is gbk
     {
         serverNameGBKToUtf8 = (char *)malloc(MAX_SQL_IDENTIFIER_LEN + 1);
         if (TranslateUTF8(TRUE, serverName, MAX_SQL_IDENTIFIER_LEN,
             serverNameGBKToUtf8, MAX_SQL_IDENTIFIER_LEN, &translen, 
transError) != SQL_SUCCESS)
         {
-            delete serverNameGBKToUtf8;
+            free(serverNameGBKToUtf8);
+            serverNameGBKToUtf8 = NULL;
             throw SecurityException(INPUT_PARAMETER_IS_NULL, " - serverName.");
         }
         certFile = buildName(certDir, fileName, serverNameGBKToUtf8, CER);
         activeCertFile = buildName(certDir, activeFileName, 
serverNameGBKToUtf8, ACTIVE_CER);
 
-        delete serverNameGBKToUtf8;
+        free(serverNameGBKToUtf8);
+        serverNameGBKToUtf8 = NULL;
     }
     else
     {

Reply via email to