• Sergey Petrunya's avatar
    MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) · 59e64b6c
    Sergey Petrunya authored
    - When JOIN::cleanup(full==TRUE) is called, the select can be in two states:
      = Right after the create_sort_index() call, when join->join_tab[0] is used to 
        read data produced by filesort().
      = After create_sort_index(), and after JOIN::reinit() calls, when 
        join->join_tab[0] has been reset to read the original data. 
    - We didn't handle the second case correctly, which resulted in an attempt to free 
      the same SQL_SELECT two times. The fix is to make sure we don't double-free.
    59e64b6c
sql_select.cc 752 KB