1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#20549: Fix missing memory initialization.

Some values were not initialized, causing Valgrind errors (and potential
random bugs):

 - NDB binlog thread thd->variables.pseudo_thread_id.
 - Table null bits.
 - Field bytes for columns with NULL values.
This commit is contained in:
knielsen@mysql.com
2006-06-22 16:42:50 +02:00
parent 1b7fe10981
commit bd5f334bed
2 changed files with 24 additions and 5 deletions

View File

@ -2475,15 +2475,19 @@ my_size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data,
int n_null_bytes= table->s->null_bytes;
byte *ptr;
uint i;
my_ptrdiff_t const offset= (my_ptrdiff_t) (record - (byte*)
table->record[0]);
my_ptrdiff_t const rec_offset= record - table->record[0];
my_ptrdiff_t const def_offset= table->s->default_values - table->record[0];
memcpy(row_data, record, n_null_bytes);
ptr= row_data+n_null_bytes;
for (i= 0 ; (field= *p_field) ; i++, p_field++)
{
if (bitmap_is_set(cols,i))
{
my_ptrdiff_t const offset=
field->is_null(rec_offset) ? def_offset : rec_offset;
ptr= (byte*)field->pack((char *) ptr, field->ptr + offset);
}
}
return (static_cast<my_size_t>(ptr - row_data));
}