Index: driver/myodbc3.h =================================================================== --- driver/myodbc3.h (revision 422) +++ driver/myodbc3.h (working copy) @@ -325,6 +325,7 @@ { DBC FAR *dbc; MYSQL_RES *result; + my_bool fake_result; MYSQL_ROW array,result_array,current_values; MYSQL_ROW (*fix_fields)(struct tagSTMT FAR* stmt,MYSQL_ROW row); MYSQL_FIELD *fields; Index: driver/handle.c =================================================================== --- driver/handle.c (revision 422) +++ driver/handle.c (working copy) @@ -423,12 +423,16 @@ if (fOption == SQL_RESET_PARAMS) MYODBCDbgReturnReturn( SQL_SUCCESS ); - mysql_free_result(stmt->result); + if (!stmt->fake_result) + mysql_free_result(stmt->result); + else + x_free((gptr)stmt->result); x_free((gptr) stmt->fields); x_free((gptr) stmt->array); x_free((gptr) stmt->result_array); x_free((gptr) stmt->odbc_types); stmt->result= 0; + stmt->fake_result= 0; stmt->result_lengths= 0; stmt->fields= 0; stmt->array= 0; Index: driver/catalog.c =================================================================== --- driver/catalog.c (revision 422) +++ driver/catalog.c (working copy) @@ -334,6 +334,7 @@ /* Return set of allowed Table owners */ MYODBCDbgInfo( "%s", "Return set of table owners / Schema names" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_owner_values, sizeof(SQLTABLES_owner_values), MYF(0)); @@ -351,6 +352,7 @@ /* Return set of TableType qualifiers */ MYODBCDbgInfo( "%s", "Return set of table types" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_type_values, sizeof(SQLTABLES_type_values), MYF(0)); @@ -533,6 +535,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_values, sizeof(SQLTABLES_values), @@ -861,6 +864,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLCOLUMNS_values, sizeof(SQLCOLUMNS_values), @@ -1039,6 +1043,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSTAT_values, sizeof(SQLSTAT_values), @@ -1231,6 +1236,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_priv_values, sizeof(SQLTABLES_priv_values), @@ -1405,6 +1411,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLCOLUMNS_priv_values, sizeof(SQLCOLUMNS_priv_values), @@ -1632,6 +1639,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSPECIALCOLUMNS_values, sizeof(SQLSPECIALCOLUMNS_values), @@ -1753,6 +1761,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLPRIM_KEYS_values, sizeof(SQLPRIM_KEYS_values), @@ -2084,7 +2093,9 @@ } else /* NO FOREIGN KEY support from SERVER */ { + /** @todo this should just goto empty_set */ stmt->result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->eof=1; } stmt->result->row_count= row_count; @@ -2095,6 +2106,7 @@ empty_set: MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" ); stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result->row_count= 0; stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLFORE_KEYS_values, sizeof(SQLFORE_KEYS_values), Index: driver/info.c =================================================================== --- driver/info.c (revision 422) +++ driver/info.c (working copy) @@ -1067,6 +1067,7 @@ /* Set up result Data dictionary. */ stmt->result= (MYSQL_RES *)my_malloc(sizeof(MYSQL_RES), MYF(MY_ZEROFILL)); + stmt->fake_result= 1; stmt->result_array= (char **)my_malloc(sizeof(SQL_GET_TYPE_INFO_values), MYF(MY_FAE | MY_ZEROFILL));