summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-25 20:55:58 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-05 17:15:57 +0200
commit75f80004b165363b10eeb9b63c342215356c98d0 (patch)
treebfaf7e3553c81ebb8f1835984d075a13b0b0e1b3 /sql/item_cmpfunc.h
parent7bea860709cf63d3180c934ab75d7042e0cd8867 (diff)
downloadmariadb-git-75f80004b165363b10eeb9b63c342215356c98d0.tar.gz
MDEV-12939 A query crashes MariaDB in Item_func_regex::cleanup
and MDEV-13144 regexp on views - crashed mariadb server implement Item_func_regex::build_clone()
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r--sql/item_cmpfunc.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 2f98c68bb5f..8ff789d983a 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -2074,15 +2074,16 @@ public:
{
return subpattern_end(n) - subpattern_start(n);
}
- void cleanup()
+ void reset()
{
- if (m_pcre)
- {
- pcre_free(m_pcre);
- m_pcre= NULL;
- }
+ m_pcre= NULL;
m_prev_pattern.length(0);
}
+ void cleanup()
+ {
+ pcre_free(m_pcre);
+ reset();
+ }
bool is_compiled() const { return m_pcre != NULL; }
bool is_const() const { return m_is_const; }
void set_const(bool arg) { m_is_const= arg; }
@@ -2110,6 +2111,13 @@ public:
enum precedence precedence() const { return CMP_PRECEDENCE; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_regex>(thd, mem_root, this); }
+ Item *build_clone(THD *thd, MEM_ROOT *mem_root)
+ {
+ Item_func_regex *clone= (Item_func_regex*) Item_bool_func::build_clone(thd, mem_root);
+ if (clone)
+ clone->re.reset();
+ return clone;
+ }
void print(String *str, enum_query_type query_type)
{