mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
fix problem of reallocated string
This commit is contained in:
@@ -634,6 +634,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
|
|
||||||
|
static char dbug_row_print_buf[4096];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Print table's current row into a buffer and return a pointer to it.
|
Print table's current row into a buffer and return a pointer to it.
|
||||||
|
|
||||||
@@ -649,11 +652,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
|
|||||||
const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
|
const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
|
||||||
{
|
{
|
||||||
Field **pfield;
|
Field **pfield;
|
||||||
const size_t alloc_size= 512;
|
char row_buff_tmp[512];
|
||||||
char *row_buff= (char *) alloc_root(&table->mem_root, alloc_size);
|
String tmp(row_buff_tmp, sizeof(row_buff_tmp), &my_charset_bin);
|
||||||
char *row_buff_tmp= (char *) alloc_root(&table->mem_root, alloc_size);
|
String output(dbug_row_print_buf, sizeof(dbug_row_print_buf), &my_charset_bin);
|
||||||
String tmp(row_buff_tmp, alloc_size, &my_charset_bin);
|
|
||||||
String output(row_buff, alloc_size, &my_charset_bin);
|
|
||||||
|
|
||||||
auto move_back_lambda= [table, rec]() mutable {
|
auto move_back_lambda= [table, rec]() mutable {
|
||||||
table->move_fields(table->field, table->record[0], rec);
|
table->move_fields(table->field, table->record[0], rec);
|
||||||
@@ -717,8 +718,10 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.append(")");
|
output.append(")");
|
||||||
|
if (output.c_ptr() == dbug_row_print_buf)
|
||||||
return output.c_ptr_safe();
|
return dbug_row_print_buf;
|
||||||
|
else
|
||||||
|
return "Couldn't fit into buffer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user