From be3070ef9359cf2287c20c56ff3b8c06b10d24da Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/eagle.(none)" <> Date: Mon, 19 Nov 2007 12:42:25 +0400 Subject: [PATCH] Bug#32158 Crash in open_table_from_share, on mysql_unpack_partition errors added check for the result of mysql_unpack_partition() --- sql/table.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sql/table.cc b/sql/table.cc index c3ddb809b9e..c30407920f4 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1787,13 +1787,18 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, outparam, is_create_table, share->default_part_db_type, &work_part_info_used); - if (!tmp) - outparam->part_info->is_auto_partitioned= share->auto_partitioned; + if (tmp) + { + thd->stmt_arena= backup_stmt_arena_ptr; + thd->restore_active_arena(&part_func_arena, &backup_arena); + goto partititon_err; + } + outparam->part_info->is_auto_partitioned= share->auto_partitioned; DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); /* we should perform the fix_partition_func in either local or caller's arena depending on work_part_info_used value */ - if (!tmp && !work_part_info_used) + if (!work_part_info_used) tmp= fix_partition_func(thd, outparam, is_create_table); thd->stmt_arena= backup_stmt_arena_ptr; thd->restore_active_arena(&part_func_arena, &backup_arena); @@ -1803,6 +1808,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, tmp= fix_partition_func(thd, outparam, is_create_table); outparam->part_info->item_free_list= part_func_arena.free_list; } +partititon_err: if (tmp) { if (is_create_table)