• Michael Widenius's avatar
    Fixes for Bug #38016 Maria: trying to access freed memory when committing a transaction · ea31b1e6
    Michael Widenius authored
    Don't write out states if they haven't changed
    
    sql/sql_base.cc:
      Call extra(HA_EXTRA_PREPARE_FOR_DROP) before doing a drop of a table
      More DBUG
    sql/sql_table.cc:
      Call extra(HA_EXTRA_PREPARE_FOR_RENAME) before renaming a table
    storage/maria/ha_maria.cc:
      Ensure that file->trn is set when we call extra(HA_EXTRA_PREPARE_FOR_DROP/RENAME)
    storage/maria/ma_close.c:
      When doing close, assert if we have pointers in trn->table_list that points to the MARIA_SHARE
    storage/maria/ma_extra.c:
      Reset info->state_start in case of drop/rename. This fixes the problem of accessing freed memory in repair
      Don't write state changed if they haven't changed
    storage/maria/ma_open.c:
      Reset share->changed after we have written out a state (speed optimization to not write states when they haven't changed)
    storage/maria/ma_state.c:
      Decrement share->in_trans properly in DBUG_BINARY to ensure that the DBUG_ASSERT() in maria_close() works
      More DBUG
    ea31b1e6
sql_table.cc 233 KB