Commit 840fb495 authored by Sujatha's avatar Sujatha

MDEV-22059: MSAN report at replicate_ignore_table_grant

Analysis:
========
List of values provided for "replicate_ignore_table" and "replicate_do_table"
are stored in HASH.  When an empty list is provided the HASH structure doesn't
get initialized. Existing code treats empty element list as an error and tries
to clean the uninitialized HASH. This results in above MSAN issue.

Fix:
===
The clean up should be initiated only when there is an error while parsing the
'replicate_do_table' or 'replicate_ignore_table' list and the HASH is in
initialized state. Otherwise for empty list it should simply return success.
parent 6e4e097b
......@@ -350,15 +350,21 @@ Rpl_filter::set_do_table(const char* table_spec)
int status;
if (do_table_inited)
my_hash_reset(&do_table);
{
my_hash_free(&do_table);
do_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
if (do_table_inited && status)
{
if (!do_table.records)
{
my_hash_free(&do_table);
do_table_inited= 0;
}
}
return status;
}
......@@ -370,15 +376,21 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status;
if (ignore_table_inited)
my_hash_reset(&ignore_table);
{
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
if (ignore_table_inited && status)
{
if (!ignore_table.records)
{
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
}
return status;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment