1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31995 Fix2 allocate memory in mem_root properly.

Lex_ident_sys had no new operator and was used incorrectly in
save_item_list_names(), so leaked memory.
This commit is contained in:
Rex
2023-11-17 13:33:07 +12:00
committed by Daniel Black
parent 36680b648a
commit 2c1345ab27
2 changed files with 12 additions and 2 deletions

View File

@ -143,6 +143,11 @@ public:
struct Lex_ident_sys_st: public LEX_CSTRING
{
public:
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
bool copy_ident_cli(THD *thd, const Lex_ident_cli_st *str);
bool copy_keyword(THD *thd, const Lex_ident_cli_st *str);
bool copy_sys(THD *thd, const LEX_CSTRING *str);
@ -176,6 +181,10 @@ public:
LEX_CSTRING tmp= {name, length};
set_valid_utf8(&tmp);
}
Lex_ident_sys(THD *thd, const LEX_CSTRING *str)
{
set_valid_utf8(str);
}
Lex_ident_sys & operator=(const Lex_ident_sys_st &name)
{
Lex_ident_sys_st::operator=(name);