Index: gwlib/dbpool_mssql.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/dbpool_mssql.c,v
retrieving revision 1.1
diff -u -b -w -r1.1 dbpool_mssql.c
--- gwlib/dbpool_mssql.c	4 May 2009 21:35:53 -0000	1.1
+++ gwlib/dbpool_mssql.c	22 Jun 2009 08:23:35 -0000
@@ -77,7 +77,7 @@
 
 #define mssql_undef_coldata(cols) \
     mssql_undef_colfmt(cols); \
-    for (j = 0; j < cols; j++) { gw_free(data[j].data); gw_free(data[j].format); } \
+    for (j = 0; j < cols; j++) { gw_free(data[j].data); } \
     gw_free(data);
 
 struct mssql_conn {
@@ -260,16 +260,18 @@
                     *res = NULL;
                     return -1;
                 }
+                mssql_undef_coldata(columns);
                 break;
             case CS_CMD_SUCCEED:
             case CS_CMD_DONE:
+            case CS_STATUS_RESULT:
                 break;
             case CS_CMD_FAIL:
                 error(0, "select failed!");
                 return -1;
                 break;
             default:
-                error(0, "ct_result returned unexpected result type");
+                error(0, "ct_result returned unexpected result type: %d", res_type);
                 return -1;
                 break;
         }
@@ -303,6 +305,7 @@
         switch ((int) result_type) {
             case CS_CMD_SUCCEED:
             case CS_CMD_DONE:
+            case CS_STATUS_RESULT:
                 break;
             default:
                 mssql_checkerr(result_type);
