mirror of
https://github.com/MariaDB/server.git
synced 2025-12-04 17:23:46 +03:00
MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name
This commit is contained in:
@@ -222,11 +222,18 @@ bool sp_rcontext::resolve_table_rowtype_ref(THD *thd,
|
|||||||
{
|
{
|
||||||
for (Field **src= lex.query_tables->table->field; *src; src++)
|
for (Field **src= lex.query_tables->table->field; *src; src++)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Make field names on the THD memory root,
|
||||||
|
as the table will be closed and freed soon,
|
||||||
|
in the end of this method.
|
||||||
|
*/
|
||||||
|
LEX_CSTRING tmp= {src[0]->field_name, strlen(src[0]->field_name)};
|
||||||
if ((rc= check_column_grant_for_type_ref(thd, table_list,
|
if ((rc= check_column_grant_for_type_ref(thd, table_list,
|
||||||
src[0]->field_name,
|
tmp.str, tmp.length)) ||
|
||||||
strlen(src[0]->field_name))))
|
(rc= !(src[0]->field_name= thd->strmake(tmp.str, tmp.length))))
|
||||||
break;
|
break;
|
||||||
Spvar_definition *def= new (thd->mem_root) Spvar_definition(thd, *src);
|
Spvar_definition *def= new (thd->mem_root) Spvar_definition(thd, *src);
|
||||||
|
src[0]->field_name= tmp.str; // Restore field name, just in case.
|
||||||
def->flags&= (uint) ~NOT_NULL_FLAG;
|
def->flags&= (uint) ~NOT_NULL_FLAG;
|
||||||
if ((rc= def->sp_prepare_create_field(thd, thd->mem_root)))
|
if ((rc= def->sp_prepare_create_field(thd, thd->mem_root)))
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user