MDEV-6262 analyze the coverity report on mariadb
uploaded 10.0, analyzed everything with the Impact=High (and a couple of Medium)
This commit is contained in:
parent
335c4ab790
commit
7c03edf2fe
@ -3061,7 +3061,6 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
||||
{
|
||||
unsigned int num_fields= mysql_num_fields(result);
|
||||
my_ulonglong num_rows= mysql_num_rows(result);
|
||||
mysql_fetch_fields(result);
|
||||
if (num_fields==3 && num_rows==1)
|
||||
{
|
||||
if (!(cur= mysql_fetch_row(result)))
|
||||
|
@ -1042,7 +1042,7 @@ static int check_version_match(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char self_name[FN_REFLEN];
|
||||
char self_name[FN_REFLEN + 1];
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
@ -1050,7 +1050,7 @@ int main(int argc, char **argv)
|
||||
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
|
||||
#endif
|
||||
{
|
||||
strncpy(self_name, argv[0], FN_REFLEN);
|
||||
strmake_buf(self_name, argv[0]);
|
||||
}
|
||||
|
||||
if (init_dynamic_string(&ds_args, "", 512, 256) ||
|
||||
|
@ -614,6 +614,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
||||
|
||||
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *status;
|
||||
/*
|
||||
MySQL documentation relies on the fact that mysqladmin will
|
||||
@ -1107,7 +1108,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
if (strcmp(typed_password, verified) != 0)
|
||||
{
|
||||
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto password_done;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1134,7 +1136,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
{
|
||||
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
|
||||
error_flags, mysql_error(mysql));
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto password_done;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1145,7 +1148,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
"Could not get old_passwords setting from "
|
||||
"server; error: '%s'",
|
||||
error_flags, mysql_error(mysql));
|
||||
return -1;
|
||||
ret = -1;
|
||||
goto password_done;
|
||||
}
|
||||
if (!mysql_num_rows(res))
|
||||
old= 1;
|
||||
@ -1170,15 +1174,15 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
{
|
||||
my_printf_error(0, "Can't turn off logging; error: '%s'",
|
||||
error_flags, mysql_error(mysql));
|
||||
return -1;
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
if (mysql_query(mysql,buff))
|
||||
{
|
||||
if (mysql_errno(mysql)!=1290)
|
||||
{
|
||||
my_printf_error(0,"unable to change password; error: '%s'",
|
||||
error_flags, mysql_error(mysql));
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1192,9 +1196,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
" --skip-grant-tables).\n"
|
||||
"Use: \"mysqladmin flush-privileges password '*'\""
|
||||
" instead", error_flags);
|
||||
return -1;
|
||||
}
|
||||
ret = -1;
|
||||
}
|
||||
password_done:
|
||||
/* free up memory from prompted password */
|
||||
if (typed_password != argv[1])
|
||||
{
|
||||
@ -1296,7 +1301,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1976,7 +1976,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
|
||||
|
||||
size_t tlen = strlen(logname);
|
||||
if (tlen > UINT_MAX)
|
||||
if (tlen > sizeof(buf) - 10)
|
||||
{
|
||||
error("Log name too long.");
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
|
@ -2818,6 +2818,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
|
||||
my_free(scv_buff);
|
||||
|
||||
if (path)
|
||||
my_fclose(sql_file, MYF(MY_WME));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else
|
||||
@ -5827,8 +5829,7 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
dynstr_free(&ds_view);
|
||||
}
|
||||
|
||||
if (switch_character_set_results(mysql, default_charset))
|
||||
DBUG_RETURN(1);
|
||||
switch_character_set_results(mysql, default_charset);
|
||||
|
||||
/* If a separate .sql file was opened, close it now */
|
||||
if (sql_file != md_result_file)
|
||||
|
@ -1721,13 +1721,12 @@ void log_msg(const char *fmt, ...)
|
||||
int cat_file(DYNAMIC_STRING* ds, const char* filename)
|
||||
{
|
||||
int fd;
|
||||
size_t len;
|
||||
int len;
|
||||
char buff[16384];
|
||||
|
||||
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
|
||||
return 1;
|
||||
while((len= my_read(fd, (uchar*)&buff,
|
||||
sizeof(buff)-1, MYF(0))) > 0)
|
||||
while((len= (int)my_read(fd, (uchar*)&buff, sizeof(buff)-1, MYF(0))) > 0)
|
||||
{
|
||||
char *p= buff, *start= buff,*end=buff+len;
|
||||
while (p < end)
|
||||
|
@ -485,7 +485,10 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
|
||||
return -1;
|
||||
if (*el == NULL && bucket &&
|
||||
unlikely(initialize_bucket(hash, el, parent, pins)))
|
||||
{
|
||||
my_free(dummy);
|
||||
return -1;
|
||||
}
|
||||
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
|
||||
dummy->key= dummy_key;
|
||||
dummy->keylen= 0;
|
||||
|
@ -4039,6 +4039,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val)
|
||||
*dbl= strtod(str, &end);
|
||||
if (*end != '\0')
|
||||
rc= ER_DYNCOL_TRUNCATED;
|
||||
free(str);
|
||||
break;
|
||||
}
|
||||
case DYN_COL_DECIMAL:
|
||||
|
@ -561,7 +561,7 @@ my_bool wt_resource_id_memcmp(const void *a, const void *b)
|
||||
{
|
||||
/* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */
|
||||
compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong));
|
||||
return memcmp(a, b, sizeof_WT_RESOURCE_ID);
|
||||
return MY_TEST(memcmp(a, b, sizeof_WT_RESOURCE_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,6 +141,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
||||
if (new_username && strcmp(new_username, info->user_name))
|
||||
strncpy(info->authenticated_as, new_username,
|
||||
sizeof(info->authenticated_as));
|
||||
info->authenticated_as[sizeof(info->authenticated_as)-1]= 0;
|
||||
|
||||
end:
|
||||
pam_end(pamh, status);
|
||||
|
@ -204,7 +204,7 @@ static void send_report(const char *when)
|
||||
/*
|
||||
otherwise, prepare the THD and TABLE_LIST,
|
||||
create and fill the temporary table with data just like
|
||||
SELECT * FROM IFROEMATION_SCHEMA.feedback is doing,
|
||||
SELECT * FROM INFORMATION_SCHEMA.FEEDBACK is doing,
|
||||
read and concatenate table data into a String.
|
||||
*/
|
||||
if (!(thd= new THD()))
|
||||
|
@ -1041,6 +1041,7 @@ static int start_logging()
|
||||
error_header();
|
||||
fprintf(stderr, "logging started to the file %s.\n", alt_fname);
|
||||
strncpy(current_log_buf, alt_fname, sizeof(current_log_buf));
|
||||
current_log_buf[sizeof(current_log_buf)-1]= 0;
|
||||
}
|
||||
else if (output_type == OUTPUT_SYSLOG)
|
||||
{
|
||||
@ -2570,6 +2571,7 @@ static void update_file_path(MYSQL_THD thd,
|
||||
}
|
||||
|
||||
strncpy(path_buffer, new_name, sizeof(path_buffer));
|
||||
path_buffer[sizeof(path_buffer)-1]= 0;
|
||||
file_path= path_buffer;
|
||||
exit_func:
|
||||
internal_stop_logging= 0;
|
||||
@ -2622,6 +2624,7 @@ static void update_incl_users(MYSQL_THD thd,
|
||||
flogger_mutex_lock(&lock_operations);
|
||||
mark_always_logged(thd);
|
||||
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
|
||||
incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
|
||||
incl_users= incl_user_buffer;
|
||||
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
||||
error_header();
|
||||
@ -2640,6 +2643,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
|
||||
flogger_mutex_lock(&lock_operations);
|
||||
mark_always_logged(thd);
|
||||
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
|
||||
excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
|
||||
excl_users= excl_user_buffer;
|
||||
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
||||
error_header();
|
||||
@ -2771,6 +2775,7 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
|
||||
{
|
||||
char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
|
||||
strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
|
||||
syslog_ident_buffer[sizeof(syslog_ident_buffer)-1]= 0;
|
||||
syslog_ident= syslog_ident_buffer;
|
||||
error_header();
|
||||
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);
|
||||
|
@ -375,8 +375,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
||||
if (!(sym= dlsym(dlhandle, plugin_declarations_sym)))
|
||||
{
|
||||
errmsg= "not a plugin";
|
||||
(void)dlclose(dlhandle);
|
||||
goto err;
|
||||
goto errc;
|
||||
}
|
||||
|
||||
plugin= (struct st_mysql_client_plugin*)sym;
|
||||
@ -384,19 +383,19 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
||||
if (type >=0 && type != plugin->type)
|
||||
{
|
||||
errmsg= "type mismatch";
|
||||
goto err;
|
||||
goto errc;
|
||||
}
|
||||
|
||||
if (strcmp(name, plugin->name))
|
||||
{
|
||||
errmsg= "name mismatch";
|
||||
goto err;
|
||||
goto errc;
|
||||
}
|
||||
|
||||
if (type < 0 && find_plugin(name, plugin->type))
|
||||
{
|
||||
errmsg= "it is already loaded";
|
||||
goto err;
|
||||
goto errc;
|
||||
}
|
||||
|
||||
plugin= add_plugin(mysql, plugin, dlhandle, argc, args);
|
||||
@ -406,6 +405,8 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
||||
DBUG_PRINT ("leave", ("plugin loaded ok"));
|
||||
DBUG_RETURN (plugin);
|
||||
|
||||
errc:
|
||||
dlclose(dlhandle);
|
||||
err:
|
||||
mysql_mutex_unlock(&LOCK_load_client_plugin);
|
||||
DBUG_PRINT ("leave", ("plugin load error : %s", errmsg));
|
||||
|
@ -89,8 +89,7 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
|
||||
error= 0;
|
||||
|
||||
err:
|
||||
if (file > 0)
|
||||
(void) mysql_file_close(file, MYF(MY_WME));
|
||||
(void) mysql_file_close(file, MYF(MY_WME));
|
||||
|
||||
err_end: /* Here when no file */
|
||||
DBUG_RETURN (error);
|
||||
|
@ -914,6 +914,7 @@ write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
|
||||
/* check we won't have more buffpeks than we can possibly keep in memory */
|
||||
if (my_b_tell(buffpek_pointers) + sizeof(BUFFPEK) > (ulonglong)UINT_MAX)
|
||||
goto err;
|
||||
bzero(&buffpek, sizeof(buffpek));
|
||||
buffpek.file_pos= my_b_tell(tempfile);
|
||||
if ((ha_rows) count > param->max_rows)
|
||||
count=(uint) param->max_rows; /* purecov: inspected */
|
||||
|
@ -7702,7 +7702,7 @@ static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff)
|
||||
{
|
||||
struct st_data {
|
||||
KEY_CACHE_STATISTICS stats;
|
||||
SHOW_VAR var[8];
|
||||
SHOW_VAR var[9];
|
||||
} *data;
|
||||
SHOW_VAR *v;
|
||||
|
||||
|
@ -7549,7 +7549,10 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
|
||||
{
|
||||
if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
|
||||
quick_roru->push_quick_back(quick))
|
||||
{
|
||||
delete quick_roru;
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
}
|
||||
quick_roru->records= records;
|
||||
quick_roru->read_time= read_cost;
|
||||
@ -11194,9 +11197,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
||||
*/
|
||||
thd->mem_root= old_root;
|
||||
|
||||
if (!quick || create_err)
|
||||
return 0; /* no ranges found */
|
||||
if (quick->init())
|
||||
if (!quick || create_err || quick->init())
|
||||
goto err;
|
||||
quick->records= records;
|
||||
|
||||
|
@ -69,7 +69,7 @@ static int rr_index_desc(READ_RECORD *info);
|
||||
bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
|
||||
bool print_error, uint idx, bool reverse)
|
||||
{
|
||||
int error;
|
||||
int error= 0;
|
||||
DBUG_ENTER("init_read_record_idx");
|
||||
|
||||
empty_record(table);
|
||||
|
@ -3022,7 +3022,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
||||
{
|
||||
stmt->state= Query_arena::STMT_ERROR;
|
||||
stmt->last_errno= thd->get_stmt_da()->sql_errno();
|
||||
strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
|
||||
strmake_buf(stmt->last_error, thd->get_stmt_da()->message());
|
||||
}
|
||||
thd->set_stmt_da(save_stmt_da);
|
||||
|
||||
|
@ -3685,9 +3685,6 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
Format_description_log_event *description_event= new
|
||||
Format_description_log_event(3); /* MySQL 4.0 by default */
|
||||
|
||||
DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
|
||||
thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
|
||||
|
||||
@ -3713,6 +3710,9 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
binary_log= &(mi->rli.relay_log);
|
||||
}
|
||||
|
||||
Format_description_log_event *description_event= new
|
||||
Format_description_log_event(3); /* MySQL 4.0 by default */
|
||||
|
||||
if (binary_log->is_open())
|
||||
{
|
||||
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
|
||||
|
@ -3016,7 +3016,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
|
||||
for (; variables->name; variables++)
|
||||
{
|
||||
bool wild_checked;
|
||||
bool wild_checked= 0;
|
||||
strnmov(prefix_end, variables->name, len);
|
||||
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
|
||||
if (ucase_names)
|
||||
|
@ -1660,7 +1660,10 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var)
|
||||
return true;
|
||||
}
|
||||
if (res->length() == 0)
|
||||
{
|
||||
list= NULL;
|
||||
list_len= 0;
|
||||
}
|
||||
else if (!(list= gtid_parse_string_to_list(res->ptr(), res->length(),
|
||||
&list_len)))
|
||||
{
|
||||
|
@ -1484,13 +1484,13 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
|
||||
/* Don't assert in field::val() functions */
|
||||
table->use_all_columns();
|
||||
if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
/* position buffer to the start of the file */
|
||||
if (init_data_file())
|
||||
DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
|
||||
|
||||
if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
/*
|
||||
Local_saved_data_file_length is initialized during the lock phase.
|
||||
Sometimes this is not getting executed before ::repair (e.g. for
|
||||
@ -1574,9 +1574,9 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
DBUG_RETURN(my_errno ? my_errno : -1);
|
||||
share->tina_write_opened= FALSE;
|
||||
}
|
||||
if (mysql_file_close(data_file, MYF(0)) ||
|
||||
mysql_file_close(repair_file, MYF(0)) ||
|
||||
mysql_file_rename(csv_key_file_data,
|
||||
mysql_file_close(data_file, MYF(0));
|
||||
mysql_file_close(repair_file, MYF(0));
|
||||
if (mysql_file_rename(csv_key_file_data,
|
||||
repaired_fname, share->data_file_name, MYF(0)))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
@ -1698,13 +1698,14 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
DBUG_ENTER("ha_tina::check");
|
||||
|
||||
old_proc_info= thd_proc_info(thd, "Checking table");
|
||||
if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
/* position buffer to the start of the file */
|
||||
if (init_data_file())
|
||||
DBUG_RETURN(HA_ERR_CRASHED);
|
||||
|
||||
if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
/*
|
||||
Local_saved_data_file_length is initialized during the lock phase.
|
||||
Check does not use store_lock in certain cases. So, we set it
|
||||
|
@ -4215,6 +4215,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
|
||||
printf("Data records: %s\n", llstr(start_records, llbuff));
|
||||
}
|
||||
|
||||
bzero(&new_data_cache, sizeof(new_data_cache));
|
||||
if (initialize_variables_for_repair(param, &sort_info, &tmp_sort_param, info,
|
||||
rep_quick, &backup_share))
|
||||
goto err;
|
||||
|
@ -953,6 +953,7 @@ static File create_logfile_by_number_no_cache(uint32 file_no)
|
||||
{
|
||||
DBUG_PRINT("error", ("Error %d during syncing directory '%s'",
|
||||
errno, log_descriptor.directory));
|
||||
mysql_file_close(file, MYF(0));
|
||||
translog_stop_writing();
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
@ -1454,17 +1455,16 @@ LSN translog_get_file_max_lsn_stored(uint32 file)
|
||||
if (translog_read_file_header(&info, fd))
|
||||
{
|
||||
DBUG_PRINT("error", ("Can't read file header"));
|
||||
DBUG_RETURN(LSN_ERROR);
|
||||
info.max_lsn= LSN_ERROR;
|
||||
}
|
||||
|
||||
if (mysql_file_close(fd, MYF(MY_WME)))
|
||||
{
|
||||
DBUG_PRINT("error", ("Can't close file"));
|
||||
DBUG_RETURN(LSN_ERROR);
|
||||
info.max_lsn= LSN_ERROR;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("Max lsn: (%lu,0x%lx)",
|
||||
LSN_IN_PARTS(info.max_lsn)));
|
||||
DBUG_PRINT("info", ("Max lsn: (%lu,0x%lx)", LSN_IN_PARTS(info.max_lsn)));
|
||||
DBUG_RETURN(info.max_lsn);
|
||||
}
|
||||
}
|
||||
@ -1638,13 +1638,15 @@ static my_bool translog_create_new_file()
|
||||
if (allocate_dynamic(&log_descriptor.open_files,
|
||||
log_descriptor.max_file - log_descriptor.min_file + 2))
|
||||
goto error_lock;
|
||||
if ((file->handler.file=
|
||||
create_logfile_by_number_no_cache(file_no)) == -1)
|
||||
|
||||
/* this call just expand the array */
|
||||
if (insert_dynamic(&log_descriptor.open_files, (uchar*)&file))
|
||||
goto error_lock;
|
||||
|
||||
if ((file->handler.file= create_logfile_by_number_no_cache(file_no)) == -1)
|
||||
goto error_lock;
|
||||
translog_file_init(file, file_no, 0);
|
||||
|
||||
/* this call just expand the array */
|
||||
insert_dynamic(&log_descriptor.open_files, (uchar*)&file);
|
||||
log_descriptor.max_file++;
|
||||
{
|
||||
char *start= (char*) dynamic_element(&log_descriptor.open_files, 0,
|
||||
@ -1678,6 +1680,7 @@ error_lock:
|
||||
mysql_rwlock_unlock(&log_descriptor.open_files_lock);
|
||||
error:
|
||||
translog_stop_writing();
|
||||
my_free(file);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@ -3985,11 +3988,14 @@ my_bool translog_init_with_table(const char *directory,
|
||||
/* Start new log system from scratch */
|
||||
log_descriptor.horizon= MAKE_LSN(start_file_num,
|
||||
TRANSLOG_PAGE_SIZE); /* header page */
|
||||
if ((file->handler.file=
|
||||
create_logfile_by_number_no_cache(start_file_num)) == -1)
|
||||
goto err;
|
||||
translog_file_init(file, start_file_num, 0);
|
||||
if (insert_dynamic(&log_descriptor.open_files, (uchar*)&file))
|
||||
{
|
||||
my_free(file);
|
||||
goto err;
|
||||
}
|
||||
if ((file->handler.file=
|
||||
create_logfile_by_number_no_cache(start_file_num)) == -1)
|
||||
goto err;
|
||||
log_descriptor.min_file= log_descriptor.max_file= start_file_num;
|
||||
if (translog_write_file_header())
|
||||
|
@ -1445,7 +1445,7 @@ uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
|
||||
maria->blob_length=info->blob_len;
|
||||
}
|
||||
info->filepos=filepos+head_length;
|
||||
if (file > 0)
|
||||
if (file >= 0)
|
||||
{
|
||||
info->offset=MY_MIN(info->rec_len, ref_length - head_length);
|
||||
memcpy(*rec_buff_p, header + head_length, info->offset);
|
||||
|
@ -1988,7 +1988,7 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT)
|
||||
const HA_KEYSEG *keyseg= info->s->keyinfo[keynr].seg;
|
||||
ulonglong value;
|
||||
char llbuf[22];
|
||||
uchar *to;
|
||||
uchar reversed[MARIA_MAX_KEY_BUFF], *to;
|
||||
tprint(tracef, " state older than record\n");
|
||||
/* we read the record to find the auto_increment value */
|
||||
enlarge_buffer(rec);
|
||||
@ -2005,7 +2005,6 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT)
|
||||
if (keyseg->flag & HA_SWAP_KEY)
|
||||
{
|
||||
/* We put key from log record to "data record" packing format... */
|
||||
uchar reversed[MARIA_MAX_KEY_BUFF];
|
||||
uchar *key_ptr= to;
|
||||
uchar *key_end= key_ptr + keyseg->length;
|
||||
to= reversed + keyseg->length;
|
||||
|
@ -1248,6 +1248,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
|
||||
{
|
||||
KEY_CACHE *new_key_cache= check_opt->key_cache;
|
||||
const char *errmsg= 0;
|
||||
char buf[STRING_BUFFER_USUAL_SIZE];
|
||||
int error= HA_ADMIN_OK;
|
||||
ulonglong map;
|
||||
TABLE_LIST *table_list= table->pos_in_table_list;
|
||||
@ -1264,7 +1265,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
|
||||
|
||||
if ((error= mi_assign_to_key_cache(file, map, new_key_cache)))
|
||||
{
|
||||
char buf[STRING_BUFFER_USUAL_SIZE];
|
||||
my_snprintf(buf, sizeof(buf),
|
||||
"Failed to flush to index file (errno: %d)", error);
|
||||
errmsg= buf;
|
||||
|
@ -151,7 +151,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
}
|
||||
share->mode=open_mode;
|
||||
errpos=1;
|
||||
if (mysql_file_read(kfile, share->state.header.file_version, head_length,
|
||||
if (mysql_file_read(kfile, (uchar*)&share->state.header, head_length,
|
||||
MYF(MY_NABP)))
|
||||
{
|
||||
my_errno= HA_ERR_NOT_A_TABLE;
|
||||
|
@ -604,6 +604,7 @@ buf_load()
|
||||
|
||||
if (dump_n == 0) {
|
||||
ut_free(dump);
|
||||
ut_free(dump_tmp);
|
||||
ut_sprintf_timestamp(now);
|
||||
buf_load_status(STATUS_NOTICE,
|
||||
"Buffer pool(s) load completed at %s "
|
||||
|
@ -321,8 +321,8 @@ dict_mem_table_col_rename_low(
|
||||
ut_ad(from_len <= NAME_LEN);
|
||||
ut_ad(to_len <= NAME_LEN);
|
||||
|
||||
char from[NAME_LEN];
|
||||
strncpy(from, s, NAME_LEN);
|
||||
char from[NAME_LEN + 1];
|
||||
strncpy(from, s, NAME_LEN + 1);
|
||||
|
||||
if (from_len == to_len) {
|
||||
/* The easy case: simply replace the column name in
|
||||
|
@ -3219,13 +3219,13 @@ innobase_convert_identifier(
|
||||
ibool file_id)/*!< in: TRUE=id is a table or database name;
|
||||
FALSE=id is an UTF-8 string */
|
||||
{
|
||||
char nz2[MAX_TABLE_NAME_LEN + 1];
|
||||
const char* s = id;
|
||||
int q;
|
||||
|
||||
if (file_id) {
|
||||
|
||||
char nz[MAX_TABLE_NAME_LEN + 1];
|
||||
char nz2[MAX_TABLE_NAME_LEN + 1];
|
||||
|
||||
/* Decode the table name. The MySQL function expects
|
||||
a NUL-terminated string. The input and output strings
|
||||
|
@ -1453,6 +1453,7 @@ log_online_setup_bitmap_file_range(
|
||||
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
|
||||
|
||||
log_online_diagnose_inconsistent_dir(bitmap_files);
|
||||
os_file_closedir(bitmap_dir);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2483,7 +2483,8 @@ purge_archived_logs(
|
||||
if (dirnamelen + strlen(fileinfo.name) + 2 > OS_FILE_MAX_PATH)
|
||||
continue;
|
||||
|
||||
snprintf(archived_log_filename + dirnamelen, OS_FILE_MAX_PATH,
|
||||
snprintf(archived_log_filename + dirnamelen,
|
||||
OS_FILE_MAX_PATH - dirnamelen - 1,
|
||||
"%s", fileinfo.name);
|
||||
|
||||
if (before_no) {
|
||||
|
@ -750,7 +750,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len)
|
||||
|
||||
/* Rules: Context */
|
||||
case _CS_CONTEXT:
|
||||
if (len < sizeof(i->context) + 1)
|
||||
if (len < sizeof(i->context))
|
||||
{
|
||||
memcpy(i->context, attr, len);
|
||||
i->context[len]= '\0';
|
||||
|
@ -1033,6 +1033,7 @@ static void test_wl4435_2()
|
||||
\
|
||||
rs_metadata= mysql_stmt_result_metadata(ps); \
|
||||
fields= mysql_fetch_fields(rs_metadata); \
|
||||
mysql_free_result(rs_metadata); \
|
||||
\
|
||||
rc= mysql_stmt_bind_result(ps, &psp); \
|
||||
check_execute(ps, rc); \
|
||||
|
@ -687,6 +687,9 @@ void test_update_many(uint *column_numbers, uint *column_values,
|
||||
err:
|
||||
ok(rc, "%s", "update_many");
|
||||
/* cleanup */
|
||||
free(val);
|
||||
free(upd);
|
||||
free(res);
|
||||
mariadb_dyncol_free(&str1);
|
||||
mariadb_dyncol_free(&str2);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user