mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21856
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-bug21856
This commit is contained in:
@ -2811,7 +2811,19 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
|
||||
|
||||
error= MYSQLparse((void *)thd) || thd->is_fatal_error ||
|
||||
thd->net.report_error || init_param_array(this);
|
||||
|
||||
/*
|
||||
The first thing we do after parse error is freeing sp_head to
|
||||
ensure that we have restored original memroot.
|
||||
*/
|
||||
if (error && lex->sphead)
|
||||
{
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
}
|
||||
|
||||
lex->safe_to_cache_query= FALSE;
|
||||
|
||||
/*
|
||||
While doing context analysis of the query (in check_prepared_statement)
|
||||
we allocate a lot of additional memory: for open tables, JOINs, derived
|
||||
@ -2837,6 +2849,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
|
||||
if (error == 0)
|
||||
error= check_prepared_statement(this, name.str != 0);
|
||||
|
||||
/* Free sp_head if check_prepared_statement() failed. */
|
||||
if (error && lex->sphead)
|
||||
{
|
||||
delete lex->sphead;
|
||||
|
Reference in New Issue
Block a user