diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-06-17 15:52:23 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-06-17 15:52:23 +0200 |
commit | 5b80e6cd5df050104aa59d16ceb4c11cf1062484 (patch) | |
tree | 118ce0b764446e79786fd4823a16a4da4ae2407d /sql/tztime.cc | |
parent | 97d610d69f46366fe1e9a3b8738d9bd4b8043eed (diff) | |
download | mariadb-git-5b80e6cd5df050104aa59d16ceb4c11cf1062484.tar.gz |
fix for valgrind warning
Diffstat (limited to 'sql/tztime.cc')
-rw-r--r-- | sql/tztime.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sql/tztime.cc b/sql/tztime.cc index 457bbeec676..3f3060fbc10 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1814,6 +1814,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) my_time_t ttime; char buff[MAX_FIELD_WIDTH]; uchar keybuff[32]; + Field *field; String abbr(buff, sizeof(buff), &my_charset_latin1); char *alloc_buff, *tz_name_buff; /* @@ -1891,8 +1892,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) */ table= tz_tables->table; tz_tables= tz_tables->next_local; - table->field[0]->store((longlong) tzid, TRUE); - table->field[0]->get_key_image(keybuff, sizeof(keybuff), Field::itRAW); + field= table->field[0]; + field->store((longlong) tzid, TRUE); + DBUG_ASSERT(field->key_length() <= sizeof(keybuff)); + field->get_key_image(keybuff, + min(field->key_length(), sizeof(keybuff)), + Field::itRAW); (void)table->file->ha_index_init(0, 1); if (table->file->ha_index_read_map(table->record[0], keybuff, @@ -1919,8 +1924,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) */ table= tz_tables->table; tz_tables= tz_tables->next_local; - table->field[0]->store((longlong) tzid, TRUE); - table->field[0]->get_key_image(keybuff, sizeof(keybuff), Field::itRAW); + field= table->field[0]; + field->store((longlong) tzid, TRUE); + DBUG_ASSERT(field->key_length() <= sizeof(keybuff)); + field->get_key_image(keybuff, + min(field->key_length(), sizeof(keybuff)), + Field::itRAW); (void)table->file->ha_index_init(0, 1); res= table->file->ha_index_read_map(table->record[0], keybuff, |