mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
get_clone() returns NULL on out-of-memory, but two of its callers in prep_alter_part_table() dereferenced the result without a check, so the server crashed: changed INTERVAL of SYSTEM_TIME partitioning ADD PARTITION under LOCK TABLES get_clone() itself did not check the allocation of Vers_part_info and dereferenced it. handle_alter_part_error() did not check the clone either. The clone only kept the DDL log entries after the table is closed. In the branch where DDL log recovery fails, write_log_completed() released the entries through lpt->part_info, which the table close may have freed, and release_log_entries() released the same entries again through the clone. That branch is not reachable now, as ddl_log_execute_entry() always returns false. The fix checks the allocation of Vers_part_info in get_clone() and the result of get_clone() in prep_alter_part_table() like the other callers there do. handle_alter_part_error() keeps a copy of DDL_LOG_STATE instead of the clone and passes it to write_log_completed() and release_log_entries(), which now take DDL_LOG_STATE. The redundant release_log_entries() after write_log_completed() is removed.
311 KiB
311 KiB