summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 61e3b89c9a3..60a7a4f6ce0 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -10209,7 +10209,8 @@ bool LEX::new_sp_instr_stmt(THD *thd,
qbuff.length= prefix.length + suffix.length;
if (!(qbuff.str= (char*) alloc_root(thd->mem_root, qbuff.length + 1)))
return true;
- memcpy(qbuff.str, prefix.str, prefix.length);
+ if (prefix.length)
+ memcpy(qbuff.str, prefix.str, prefix.length);
strmake(qbuff.str + prefix.length, suffix.str, suffix.length);
i->m_query= qbuff;
return sphead->add_instr(i);