summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-04-03 21:08:23 +0200
committerSergei Golubchik <serg@mariadb.org>2017-04-07 09:55:54 +0200
commit30ed99cb8259b0bd3eb4c7c98d88d565eb8712bb (patch)
tree852b58049ab6c11515a517e22071c48a0e3e524d
parent82196f0131a26c0f72e7452ff172eb2f93067efd (diff)
downloadmariadb-git-30ed99cb8259b0bd3eb4c7c98d88d565eb8712bb.tar.gz
ASAN errors in many rpl tests
Annotate_rows_log_event should always restore thd->query_string if it was backed up. Even if the backed up value is NULL.
-rw-r--r--sql/log_event.cc7
-rw-r--r--sql/log_event.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 3aea3eaf2f1..156f5bac7b7 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -11322,7 +11322,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(THD *thd,
bool direct)
: Log_event(thd, 0, using_trans),
m_save_thd_query_txt(0),
- m_save_thd_query_len(0)
+ m_save_thd_query_len(0), m_saved_thd_query(false)
{
m_query_txt= thd->query();
m_query_len= thd->query_length();
@@ -11336,7 +11336,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(const char *buf,
const Format_description_log_event *desc)
: Log_event(buf, desc),
m_save_thd_query_txt(0),
- m_save_thd_query_len(0)
+ m_save_thd_query_len(0), m_saved_thd_query(false)
{
m_query_len= event_len - desc->common_header_len;
m_query_txt= (char*) buf + desc->common_header_len;
@@ -11345,7 +11345,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(const char *buf,
Annotate_rows_log_event::~Annotate_rows_log_event()
{
#ifndef MYSQL_CLIENT
- if (m_save_thd_query_txt)
+ if (m_saved_thd_query)
thd->set_query(m_save_thd_query_txt, m_save_thd_query_len);
#endif
}
@@ -11431,6 +11431,7 @@ int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi)
{
m_save_thd_query_txt= thd->query();
m_save_thd_query_len= thd->query_length();
+ m_saved_thd_query= true;
thd->set_query(m_query_txt, m_query_len);
return 0;
}
diff --git a/sql/log_event.h b/sql/log_event.h
index 5689d36aea8..6c6dce7e18e 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -3885,6 +3885,7 @@ private:
uint m_query_len;
char *m_save_thd_query_txt;
uint m_save_thd_query_len;
+ bool m_saved_thd_query;
};
/**