summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-02-01 20:03:18 +0200
committerMonty <monty@mariadb.org>2018-02-01 20:03:44 +0200
commit859fe1f24d499b34d31807d267a534a7f72e9c03 (patch)
tree6fc1410c6868b9a96315e083eb75810daefd9d41 /sql/sp_head.cc
parent44314c768f45ff7f0ad5d1133f4fd9ae0df12585 (diff)
downloadmariadb-git-859fe1f24d499b34d31807d267a534a7f72e9c03.tar.gz
Ensure that thd->user_var_events_alloc is always relevant
If binary logging is not enabled thd->user_var_events_alloc would never be initialized.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 8b05d14f2de..eca72f4d643 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1135,6 +1135,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
uint old_server_status;
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
SERVER_STATUS_LAST_ROW_SENT;
+ MEM_ROOT *user_var_events_alloc_saved= 0;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
Diagnostics_area *da= thd->get_stmt_da();
@@ -1326,9 +1327,11 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Will write this SP statement into binlog separately.
TODO: consider changing the condition to "not inside event union".
*/
- MEM_ROOT *user_var_events_alloc_saved= thd->user_var_events_alloc;
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
+ {
+ user_var_events_alloc_saved= thd->user_var_events_alloc;
thd->user_var_events_alloc= thd->mem_root;
+ }
sql_digest_state *parent_digest= thd->m_digest;
thd->m_digest= NULL;