Valgrind on the same testcase
==19862== Thread 21: ==19862== Invalid write of size 8 ==19862== at 0xBAAB01: ha_myisam::open(char const*, int, unsigned int) (ha_myisam.cc:748) ==19862== by 0x658CB9: handler::ha_open(TABLE*, char const*, int, int) (handler.cc:2744) ==19862== by 0x658840: handler::clone(char const*, st_mem_root*) (handler.cc:2658) ==19862== by 0xBAA966: ha_myisam::clone(char const*, st_mem_root*) (ha_myisam.cc:655) ==19862== by 0x86ECE2: store_temporary_table_record(THD*, TABLE*, TABLE*, char const*) (sql_show.cc:4175) ==19862== by 0x86F286: fill_global_temporary_tables(THD*, TABLE_LIST*, Item*) (sql_show.cc:4266) ==19862== by 0x87F61F: do_fill_table(THD*, TABLE_LIST*, st_join_table*) (sql_show.cc:8013) ==19862== by 0x87FA35: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:8115) ==19862== by 0x84DC11: JOIN::prepare_result(List<Item>**) (sql_select.cc:823) ==19862== by 0x7E335B: JOIN::exec() (sql_executor.cc:116) ==19862== by 0x84E879: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1101) ==19862== by 0x84EBB4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1222) ==19862== by 0x84C884: handle_select(THD*, select_result*, unsigned long) (sql_select.cc:110) ==19862== by 0x8204D3: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5683) ==19862== by 0x81854F: mysql_execute_command(THD*) (sql_parse.cc:3005) ==19862== by 0x9F2397: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_instr.cc:953) ==19862== Address 0x15a40f58 is 1,064 bytes inside a block of size 1,168 free'd ==19862== at 0x4C2EDEB: free (vg_replace_malloc.c:530) ==19862== by 0xB2FED2: my_free (my_malloc.c:140) ==19862== by 0xB26C79: free_root (my_alloc.c:373) ==19862== by 0x815FC1: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1899) ==19862== by 0x813710: do_command(THD*) (sql_parse.cc:1053) ==19862== by 0x7D6687: do_handle_one_connection(THD*) (sql_connect.cc:1541) ==19862== by 0x7D611F: handle_one_connection (sql_connect.cc:1444) ==19862== by 0xB989B2: pfs_spawn_thread (pfs.cc:1860) ==19862== by 0x5F656F9: start_thread (pthread_create.c:333) ==19862== by 0x6B22B5C: clone (clone.S:109) ==19862== Block was alloc'd at ==19862== at 0x4C2DB8F: malloc (vg_replace_malloc.c:299) ==19862== by 0xB2FA42: my_malloc (my_malloc.c:38) ==19862== by 0xB26357: alloc_root (my_alloc.c:173) ==19862== by 0x644476: Sql_alloc::operator new(unsigned long, st_mem_root*) (sql_alloc.h:40) ==19862== by 0xBA847B: myisam_create_handler(handlerton*, TABLE_SHARE*, st_mem_root*) (ha_myisam.cc:137) ==19862== by 0x653C56: get_new_handler(TABLE_SHARE*, st_mem_root*, handlerton*) (handler.cc:476) ==19862== by 0x65876E: handler::clone(char const*, st_mem_root*) (handler.cc:2636) ==19862== by 0xBAA966: ha_myisam::clone(char const*, st_mem_root*) (ha_myisam.cc:655) ==19862== by 0x86ECE2: store_temporary_table_record(THD*, TABLE*, TABLE*, char const*) (sql_show.cc:4175) ==19862== by 0x86F286: fill_global_temporary_tables(THD*, TABLE_LIST*, Item*) (sql_show.cc:4266) ==19862== by 0x87F61F: do_fill_table(THD*, TABLE_LIST*, st_join_table*) (sql_show.cc:8013) ==19862== by 0x87FA35: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:8115) ==19862== by 0x84DC11: JOIN::prepare_result(List<Item>**) (sql_select.cc:823) ==19862== by 0x7E335B: JOIN::exec() (sql_executor.cc:116) ==19862== by 0x84E879: mysql_execute_select(THD*, st_select_lex*, bool) (sql_select.cc:1101) ==19862== by 0x84EBB4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:1222)
Valgrind on the same testcase
==19862== Thread 21: :open(char const*, int, unsigned int) (ha_myisam.cc:748) :ha_open( TABLE*, char const*, int, int) (handler.cc:2744) :clone( char const*, st_mem_root*) (ha_myisam.cc:655) _table_ record( THD*, TABLE*, TABLE*, char const*) (sql_show.cc:4175) temporary_ tables( THD*, TABLE_LIST*, Item*) (sql_show.cc:4266) tables_ result( JOIN*, enum_schema_ table_state) (sql_show.cc:8115) result( List<Item> **) (sql_select.cc:823) cc:116) select( THD*, st_select_lex*, bool) (sql_select. cc:1101) st_order> *, SQL_I_List< st_order> *, Item*, unsigned long long, select_result*, st_select_ lex_unit* , st_select_lex*) (sql_select. cc:1222) sqlcom_ select( THD*, TABLE_LIST*) (sql_parse.cc:5683) command( THD*) (sql_parse.cc:3005) stmt::exec_ core(THD* , unsigned int*) (sp_instr.cc:953) malloc. c:530) command( enum_server_ command, THD*, char*, unsigned int) (sql_parse.cc:1899) one_connection( THD*) (sql_connect. cc:1541) one_connection (sql_connect. cc:1444) create. c:333) malloc. c:299) create_ handler( handlerton* , TABLE_SHARE*, st_mem_root*) (ha_myisam.cc:137) handler( TABLE_SHARE* , st_mem_root*, handlerton*) (handler.cc:476) :clone( char const*, st_mem_root*) (ha_myisam.cc:655) _table_ record( THD*, TABLE*, TABLE*, char const*) (sql_show.cc:4175) temporary_ tables( THD*, TABLE_LIST*, Item*) (sql_show.cc:4266) tables_ result( JOIN*, enum_schema_ table_state) (sql_show.cc:8115) result( List<Item> **) (sql_select.cc:823) cc:116) select( THD*, st_select_lex*, bool) (sql_select. cc:1101) st_order> *, SQL_I_List< st_order> *, Item*, unsigned long long, select_result*, st_select_ lex_unit* , st_select_lex*) (sql_select. cc:1222)
==19862== Invalid write of size 8
==19862== at 0xBAAB01: ha_myisam:
==19862== by 0x658CB9: handler:
==19862== by 0x658840: handler::clone(char const*, st_mem_root*) (handler.cc:2658)
==19862== by 0xBAA966: ha_myisam:
==19862== by 0x86ECE2: store_temporary
==19862== by 0x86F286: fill_global_
==19862== by 0x87F61F: do_fill_table(THD*, TABLE_LIST*, st_join_table*) (sql_show.cc:8013)
==19862== by 0x87FA35: get_schema_
==19862== by 0x84DC11: JOIN::prepare_
==19862== by 0x7E335B: JOIN::exec() (sql_executor.
==19862== by 0x84E879: mysql_execute_
==19862== by 0x84EBB4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<
==19862== by 0x84C884: handle_select(THD*, select_result*, unsigned long) (sql_select.cc:110)
==19862== by 0x8204D3: execute_
==19862== by 0x81854F: mysql_execute_
==19862== by 0x9F2397: sp_instr_
==19862== Address 0x15a40f58 is 1,064 bytes inside a block of size 1,168 free'd
==19862== at 0x4C2EDEB: free (vg_replace_
==19862== by 0xB2FED2: my_free (my_malloc.c:140)
==19862== by 0xB26C79: free_root (my_alloc.c:373)
==19862== by 0x815FC1: dispatch_
==19862== by 0x813710: do_command(THD*) (sql_parse.cc:1053)
==19862== by 0x7D6687: do_handle_
==19862== by 0x7D611F: handle_
==19862== by 0xB989B2: pfs_spawn_thread (pfs.cc:1860)
==19862== by 0x5F656F9: start_thread (pthread_
==19862== by 0x6B22B5C: clone (clone.S:109)
==19862== Block was alloc'd at
==19862== at 0x4C2DB8F: malloc (vg_replace_
==19862== by 0xB2FA42: my_malloc (my_malloc.c:38)
==19862== by 0xB26357: alloc_root (my_alloc.c:173)
==19862== by 0x644476: Sql_alloc::operator new(unsigned long, st_mem_root*) (sql_alloc.h:40)
==19862== by 0xBA847B: myisam_
==19862== by 0x653C56: get_new_
==19862== by 0x65876E: handler::clone(char const*, st_mem_root*) (handler.cc:2636)
==19862== by 0xBAA966: ha_myisam:
==19862== by 0x86ECE2: store_temporary
==19862== by 0x86F286: fill_global_
==19862== by 0x87F61F: do_fill_table(THD*, TABLE_LIST*, st_join_table*) (sql_show.cc:8013)
==19862== by 0x87FA35: get_schema_
==19862== by 0x84DC11: JOIN::prepare_
==19862== by 0x7E335B: JOIN::exec() (sql_executor.
==19862== by 0x84E879: mysql_execute_
==19862== by 0x84EBB4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<