summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2019-12-18 15:00:47 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-01-07 18:27:05 +0530
commit5a54e84e5d60602a97392eb284ba3b3b69a61bda (patch)
treedbd2c0eedd0351d73106f0e00452b37470e6692b
parent913f405d95d757d229892a0a5e3bd1d72efb2838 (diff)
downloadmariadb-git-5a54e84e5d60602a97392eb284ba3b3b69a61bda.tar.gz
MDEV-18046: Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events
Problem: ======== SHOW BINLOG EVENTS FROM <pos> reports following crash when ASAN is enabled. SEGV on unknown address in inline_mysql_mutex_destroy in my_bitmap_free in Update_rows_log_event::~Update_rows_log_event() Fix: === **Part3: Initialize m_cols_ai.bitmap to NULL**
-rw-r--r--sql/log_event.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 588647fc390..c22743501aa 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9513,7 +9513,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
uint8 const common_header_len= description_event->common_header_len;
Log_event_type event_type= (Log_event_type) buf[EVENT_TYPE_OFFSET];
m_type= event_type;
-
+ m_cols_ai.bitmap= 0;
+
uint8 const post_header_len= description_event->post_header_len[event_type-1];
DBUG_PRINT("enter",("event_len: %u common_header_len: %d "
@@ -12746,9 +12747,12 @@ void Update_rows_log_event::init(MY_BITMAP const *cols)
Update_rows_log_event::~Update_rows_log_event()
{
- if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
- m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
- my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
+ if (m_cols_ai.bitmap)
+ {
+ if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
+ m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
+ my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
+ }
}