From 7906bee67bf3b9f9124da12dd1492d7b766bd53e Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 4 Jun 2019 12:41:52 +0530 Subject: MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF , window functions and views Adding destructor for Group_bound_tracker to free Cached_item_str. The Cached_item for window functions are allocated on THD:mem_root but the Cached_item_str has value of type string which is allocated on the heap, so we need to call free() for it --- sql/item_windowfunc.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sql/item_windowfunc.h') diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 21270733051..b9df1b7482b 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -28,11 +28,6 @@ public: first_check= true; } - void cleanup() - { - group_fields.empty(); - } - /* Check if the current row is in a different group than the previous row this function was called for. @@ -70,6 +65,10 @@ public: } return 0; } + ~Group_bound_tracker() + { + group_fields.delete_elements(); + } private: List group_fields; @@ -199,7 +198,6 @@ public: { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } @@ -269,7 +267,6 @@ class Item_sum_dense_rank: public Item_sum_int { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } @@ -537,7 +534,6 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } -- cgit v1.2.1