Commit 6c2c9ddb authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-26182 fixes for --ps

* invoke parent's cleanup()
* don't reinit memroot, if already inited (causes memory leak)

also move free_root() from destructor to cleanup() to not accumulate
allocations from prepare and multiple executes
parent 877a75e2
......@@ -5207,6 +5207,7 @@ bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd)
Scan value uses the hash table to get the intersection of two arrays.
*/
if (!root_inited)
init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_root, 1024, 0, MYF(0));
root_inited= true;
......@@ -5360,6 +5361,7 @@ bool Item_func_json_object_filter_keys::fix_length_and_dec(THD *thd)
json_scan_start(&je2, js2->charset(),(const uchar *) js2->ptr(),
(const uchar *) js2->ptr() + js2->length());
if (!root_inited)
init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_root, 1024, 0, MYF(0));
root_inited= true;
......
......@@ -900,11 +900,9 @@ class Item_func_json_array_intersect: public Item_str_func
{ return get_item_copy<Item_func_json_array_intersect>(thd, this); }
void cleanup() override
{
Item_str_func::cleanup();
if (hash_inited)
my_hash_free(&items);
}
~Item_func_json_array_intersect()
{
if (root_inited)
free_root(&hash_root, MYF(0));
}
......@@ -932,11 +930,9 @@ class Item_func_json_object_filter_keys: public Item_str_func
void cleanup() override
{
Item_str_func::cleanup();
if (hash_inited)
my_hash_free(&items);
}
~Item_func_json_object_filter_keys()
{
if (root_inited)
free_root(&hash_root, MYF(0));
}
......
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