diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 13 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 6 | ||||
-rw-r--r-- | client/mysqldump.c | 5 | ||||
-rw-r--r-- | client/mysqltest.c | 5 |
4 files changed, 9 insertions, 20 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 480a0deb347..635973e946c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1430,12 +1430,6 @@ static void build_completion_hash(bool rehash, bool write_info) if (status.batch || quick || !current_db) DBUG_VOID_RETURN; // We don't need completion in batches - if (tables) - { - mysql_free_result(tables); - tables=0; - } - /* hash SQL commands */ while (cmd->name) { add_word(&ht,(char*) cmd->name); @@ -1681,8 +1675,8 @@ static int com_server_help(String *buffer __attribute__((unused)), else if (num_fields >= 2 && num_rows) { init_pager(); - char last_char; - + char last_char= 0; + int num_name= 0, num_cat= 0; LINT_INIT(num_name); LINT_INIT(num_cat); @@ -1693,7 +1687,6 @@ static int com_server_help(String *buffer __attribute__((unused)), put_info("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following", INFO_INFO); num_name= 0; num_cat= 1; - last_char= '_'; } else if ((cur= mysql_fetch_row(result))) { @@ -1703,7 +1696,7 @@ static int com_server_help(String *buffer __attribute__((unused)), num_cat= 2; print_help_item(&cur,1,2,&last_char); } - + while ((cur= mysql_fetch_row(result))) print_help_item(&cur,num_name,num_cat,&last_char); tee_fprintf(PAGER, "\n"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index de53831c43d..7ddb01d9ec8 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -717,11 +717,7 @@ static int check_master_version(MYSQL* mysql) if (mysql_query(mysql, "SELECT VERSION()") || !(res = mysql_store_result(mysql))) - { - mysql_close(mysql); - die("Error checking master version: %s", - mysql_error(mysql)); - } + die("Error checking master version: %s", mysql_error(mysql)); if (!(row = mysql_fetch_row(res))) { mysql_free_result(res); diff --git a/client/mysqldump.c b/client/mysqldump.c index 7280bea43f3..00f5272e3d7 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2328,14 +2328,13 @@ static const char *check_if_ignore_table(const char *table_name) fprintf(stderr, "Error: Couldn't read status information for table %s (%s)\n", table_name, mysql_error(sock)); - if (res) - mysql_free_result(res); + mysql_free_result(res); return 0; /* assume table is ok */ } if (strcmp(row[1], (result= "MRG_MyISAM")) && strcmp(row[1], (result= "MRG_ISAM"))) result= 0; - mysql_free_result(res); + mysql_free_result(res); return result; } diff --git a/client/mysqltest.c b/client/mysqltest.c index abacd73d878..d81e199ab1f 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -715,9 +715,10 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw, die("Empty variable"); } length= (uint) (var_name - save_var_name); + if (length >= MAX_VAR_NAME) + die("Too long variable name: %s", save_var_name); - if (!(v = (VAR*) hash_search(&var_hash, save_var_name, length)) && - length < MAX_VAR_NAME) + if (!(v = (VAR*) hash_search(&var_hash, save_var_name, length))) { char buff[MAX_VAR_NAME+1]; strmake(buff, save_var_name, length); |