summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 57209c918cf..5328471f4c0 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -720,11 +720,18 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulong sql_mode,
ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont;
Silence_deprecated_warning warning_handler;
+ Parser_state parser_state;
thd->variables.sql_mode= sql_mode;
thd->variables.select_limit= HA_POS_ERROR;
- Parser_state parser_state(thd, defstr->c_ptr(), defstr->length());
+ if (parser_state.init(thd, defstr->c_ptr(), defstr->length()))
+ {
+ thd->variables.sql_mode= old_sql_mode;
+ thd->variables.select_limit= old_select_limit;
+ return NULL;
+ }
+
lex_start(thd);
thd->push_internal_handler(&warning_handler);
thd->spcont= 0;