Index: driver/results.c =================================================================== --- driver/results.c (revision 1098) +++ driver/results.c (working copy) @@ -505,7 +505,7 @@ for ( nparam= 0; nparam < stmt->param_count; nparam++ ) { - DESCREC *aprec= desc_get_rec(stmt->apd, nparam, FALSE); + DESCREC *aprec= desc_get_rec(stmt->apd, nparam, TRUE); if (!aprec->par.real_param_done) { /* do the dummy bind temporarily to get the result set Index: test/my_result.c =================================================================== --- test/my_result.c (revision 1098) +++ test/my_result.c (working copy) @@ -2366,6 +2366,27 @@ } +/* + Bug #36069 - SQLProcedures followed by a SQLFreeStmt causes a crash + */ +DECLARE_TEST(t_bug36069) +{ + SQLSMALLINT size; + + ok_stmt(hstmt, SQLProcedures(hstmt, NULL, 0, NULL, 0, + "non-existing", SQL_NTS)); + ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_RESET_PARAMS)); + ok_stmt(hstmt, SQLNumResultCols(hstmt, &size)); + ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); + + ok_stmt(hstmt, SQLPrepare(hstmt, "select ?", SQL_NTS)); + ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_RESET_PARAMS)); + ok_stmt(hstmt, SQLNumResultCols(hstmt, &size)); + + return OK; +} + + BEGIN_TESTS ADD_TEST(my_resultset) ADD_TEST(t_convert_type) @@ -2401,6 +2422,7 @@ ADD_TEST(t_bug34429) ADD_TEST(t_bug32420) ADD_TEST(t_bug34575) + ADD_TEST(t_bug36069) END_TESTS