diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-09-06 09:37:33 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-10-12 13:28:10 +0200 |
commit | 513c8b4c25e5b917916e2c6f26ef9ad1bff4890e (patch) | |
tree | 7e6b9ee363bdd48561389b9166a1ec2808acd1b4 /sql/item_strfunc.h | |
parent | 8150f52e4769cd3b894549656933987c1ef8af2d (diff) | |
download | mariadb-git-513c8b4c25e5b917916e2c6f26ef9ad1bff4890e.tar.gz |
cannot allocate a new String[] in the ::val_str() method
String inherits from Sql_alloc, so it's allocated on the thd's memroot,
this cannot be done per row.
Moved String[] allocation into the Item_func_sformat constructor
(not fix_fields(), because we want it on the same memroot where the item
is).
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index d06f07d8c34..5ba6b12ee06 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -588,9 +588,10 @@ public: class Item_func_sformat :public Item_str_func { + String *val_arg; public: - Item_func_sformat(THD *thd, List<Item> &list): - Item_str_func(thd, list) { } + Item_func_sformat(THD *thd, List<Item> &list); + ~Item_func_sformat() { delete [] val_arg; } String *val_str(String*) override; bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override |