diff options
author | Andrei Elkin <andrei.elkin@oracle.com> | 2012-07-05 14:37:48 +0300 |
---|---|---|
committer | Andrei Elkin <andrei.elkin@oracle.com> | 2012-07-05 14:37:48 +0300 |
commit | dbd63d008f00ee249a7e207014d17630cb8ffb7e (patch) | |
tree | fafa0a0b0221db9c8d72bf7fcc51c3d92a103da4 /sql/log_event.cc | |
parent | 176d6b1dcae7470441ff1eefd3bfc27c6db137f8 (diff) | |
download | mariadb-git-dbd63d008f00ee249a7e207014d17630cb8ffb7e.tar.gz |
Bug#14275000
Fixes for BUG11761686 left a flaw that managed to slip away from testing.
Only effective filtering branch was actually tested with a regression test
added to rpl_filter_tables_not_exist.
The reason of the failure is destuction of too early mem-root-allocated memory
at the end of the deferred User-var's do_apply_event().
Fixed with bypassing free_root() in the deferred execution branch.
Deallocation of created in do_apply_event() items is done by the base code
through THD::cleanup_after_query() -> free_items() that the parent Query
can't miss.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index a47b3680d82..1822951cccf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5640,6 +5640,9 @@ User_var_log_event:: User_var_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) +#ifndef MYSQL_CLIENT + , deferred(false) +#endif { /* The Post-Header is empty. The Variable Data part begins immediately. */ buf+= description_event->common_header_len + @@ -5848,7 +5851,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) CHARSET_INFO *charset; if (rli->deferred_events_collecting) + { + set_deferred(); return rli->deferred_events->add(this); + } if (!(charset= get_charset(charset_number, MYF(MY_WME)))) return 1; @@ -5900,7 +5906,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) return 0; } } - Item_func_set_user_var e(user_var_name, it); + + Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it); /* Item_func_set_user_var can't substitute something else on its place => 0 can be passed as last argument (reference on item) @@ -5909,7 +5916,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) crash the server, so if fix fields fails, we just return with an error. */ - if (e.fix_fields(thd, 0)) + if (e->fix_fields(thd, 0)) return 1; /* @@ -5917,8 +5924,9 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) a single record and with a single column. Thus, like a column value, it could always have IMPLICIT derivation. */ - e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0); - free_root(thd->mem_root,0); + e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0); + if (!is_deferred()) + free_root(thd->mem_root,0); return 0; } |