1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fix stmt_close not to close the resources on error(libmysql)

Enable test_stmt_close() and test output to stdout(client_test)
This commit is contained in:
venu@myvenu.com
2003-01-27 10:54:45 -08:00
parent 6af9b46e5f
commit ca62e9f6a0
2 changed files with 49 additions and 33 deletions

View File

@ -5289,7 +5289,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
*/
static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{
my_bool error=0;
my_bool error= 0;
DBUG_ENTER("mysql_stmt_close");
DBUG_ASSERT(stmt != 0);
@ -5299,12 +5299,14 @@ static my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
int4store(buff, stmt->stmt_id);
error= simple_command(stmt->mysql, COM_CLOSE_STMT, buff, 4, 1);
}
mysql_free_result(stmt->result);
free_root(&stmt->mem_root, MYF(0));
my_free((gptr) stmt->query, MYF(MY_WME | MY_ALLOW_ZERO_PTR));
if (!skip_list)
stmt->mysql->stmts= list_delete(stmt->mysql->stmts, &stmt->list);
my_free((gptr) stmt, MYF(MY_WME));
if (!error)
{
mysql_free_result(stmt->result);
free_root(&stmt->mem_root, MYF(0));
if (!skip_list)
stmt->mysql->stmts= list_delete(stmt->mysql->stmts, &stmt->list);
my_free((gptr) stmt, MYF(MY_WME));
}
DBUG_RETURN(error);
}