Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,10 @@ bool Item::aggregate_type(const char *name, Item **items, uint count) {
if (mixed_signs && is_integer_type(new_type)) {
bool bump_range = false;
new_unsigned = false;
for (uint i = 0; i < count; i++)
bump_range |= (items[i]->unsigned_flag &&
(items[i]->data_type() == new_type ||
items[i]->data_type() == MYSQL_TYPE_BIT));
for (uint i = 0; i <= count; i++)
bump_range |= (items[i]->unsigned_flag &&
(items[i]->data_type() == new_type ||
items[i]->data_type() == MYSQL_TYPE_BIT));
if (bump_range) {
switch (new_type) {
case MYSQL_TYPE_TINY:
Expand Down
8 changes: 6 additions & 2 deletions sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1127,9 +1127,12 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) {
wild, strlen(wild), false))
continue;

char *temp_name = new char[share->table_name.length + 1];
strcpy(temp_name, share->table_name.str);

if (!(*start_list = (OPEN_TABLE_LIST *)(*THR_MALLOC)
->Alloc(sizeof(**start_list) +
share->table_cache_key.length))) {
->Alloc(sizeof(**start_list) +
share->table_cache_key.length))) {
open_list = nullptr; // Out of memory
break;
}
Expand All @@ -1144,6 +1147,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) {
(*start_list)->locked = 0; /* Obsolete. */
start_list = &(*start_list)->next;
*start_list = nullptr;
delete[] temp_name;
}
table_cache_manager.unlock_all_and_tdc();

Expand Down
2 changes: 1 addition & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,7 @@ bool dispatch_command(THD *thd, const COM_DATA *com_data,
const LEX_CSTRING orig_query = thd->query();

Parser_state parser_state;
if (parser_state.init(thd, thd->query().str, thd->query().length)) {
if (parser_state.init(thd, thd->query().str, thd->query().length + 1)) {
MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(thd->m_statement_psi, false);
break;
}
Expand Down