Index: funcs/func_odbc.c =================================================================== --- funcs/func_odbc.c (revision 310135) +++ funcs/func_odbc.c (working copy) @@ -343,6 +343,10 @@ if (stmt && rows == 0 && ast_str_strlen(insertbuf) != 0) { SQLCloseCursor(stmt); SQLFreeHandle(SQL_HANDLE_STMT, stmt); + if (obj && !transactional) { + ast_odbc_release_obj(obj); + obj = NULL; + } for (dsn = 0; dsn < 5; dsn++) { if (!ast_strlen_zero(query->writehandle[dsn])) { obj = ast_odbc_request_obj(query->writehandle[dsn], 0);