diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 565a1b964b5..3f3b63e53ed 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2730,7 +2730,10 @@ bool get_window_functions_required_cursors( item_win_func->requires_special_cursors()) { if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + { + delete cursor_manager; return true; + } cursor_managers->push_back(cursor_manager); continue; }