Commit fe8181ac authored by Monty's avatar Monty

Fixed issues found by valgrind

- mysqltest didn't free read_command_buf
- wait_for_slave_param did write different things to the log if valgrind
  was used.
- Table open cache should not write the initial variable value as it
  can depend on the configuration or if valgrind is used
- A variable in GetResult was used uninitalized
parent 3b234104
...@@ -193,6 +193,7 @@ static char TMPDIR[FN_REFLEN]; ...@@ -193,6 +193,7 @@ static char TMPDIR[FN_REFLEN];
static char global_subst_from[200]; static char global_subst_from[200];
static char global_subst_to[200]; static char global_subst_to[200];
static char *global_subst= NULL; static char *global_subst= NULL;
static char *read_command_buf= NULL;
static MEM_ROOT require_file_root; static MEM_ROOT require_file_root;
static const my_bool my_true= 1; static const my_bool my_true= 1;
static const my_bool my_false= 0; static const my_bool my_false= 0;
...@@ -1531,6 +1532,7 @@ void free_used_memory() ...@@ -1531,6 +1532,7 @@ void free_used_memory()
free_defaults(default_argv); free_defaults(default_argv);
free_root(&require_file_root, MYF(0)); free_root(&require_file_root, MYF(0));
free_re(); free_re();
my_free(read_command_buf);
#ifdef _WIN32 #ifdef _WIN32
free_tmp_sh_file(); free_tmp_sh_file();
free_win_path_patterns(); free_win_path_patterns();
...@@ -6563,7 +6565,6 @@ static inline bool is_escape_char(char c, char in_string) ...@@ -6563,7 +6565,6 @@ static inline bool is_escape_char(char c, char in_string)
*/ */
static char *read_command_buf= NULL;
static size_t read_command_buflen= 0; static size_t read_command_buflen= 0;
static const size_t max_multibyte_length= 6; static const size_t max_multibyte_length= 6;
......
...@@ -69,7 +69,7 @@ if (!$_slave_param_comparison) ...@@ -69,7 +69,7 @@ if (!$_slave_param_comparison)
if ($rpl_debug) if ($rpl_debug)
{ {
--echo Waiting until '$slave_param' $_slave_param_comparison '$slave_param_value' [timeout='$_slave_timeout', \$slave_error_param='$slave_error_param'] --echo Waiting until '$slave_param' $_slave_param_comparison '$slave_param_value' [\$slave_error_param='$slave_error_param']
} }
--let $_slave_check_configured= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1) --let $_slave_check_configured= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1)
......
...@@ -41,7 +41,7 @@ START SLAVE; ...@@ -41,7 +41,7 @@ START SLAVE;
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' .. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ==== ...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' ... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Last_IO_Errno'] Waiting until 'Slave_IO_Running' = 'Yes' [$slave_error_param='Last_IO_Errno']
[connection slave] [connection slave]
...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ==== ...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' ... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
...@@ -52,7 +52,7 @@ Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Las ...@@ -52,7 +52,7 @@ Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Las
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1' .. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ==== ...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' ... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
Waiting until 'Slave_SQL_Running' = 'Yes' [timeout='300', $slave_error_param='1'] Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='1']
[connection slave] [connection slave]
...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ==== ...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1' ... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
......
SET @start_value = @@global.table_open_cache ; SET @start_value = @@global.table_open_cache ;
SELECT @start_value;
@start_value
421
'#--------------------FN_DYNVARS_001_01------------------------#'
SET @@global.table_open_cache = 99;
SET @@global.table_open_cache = DeFAULT;
SELECT @@global.table_open_cache;
@@global.table_open_cache
2000
'#---------------------FN_DYNVARS_001_02-------------------------#' '#---------------------FN_DYNVARS_001_02-------------------------#'
SET @@global.table_open_cache = Default; SET @@global.table_open_cache = Default;
SELECT @@global.table_open_cache = 400; SELECT @@global.table_open_cache > 0;
@@global.table_open_cache = 400 @@global.table_open_cache > 0
0 1
'#--------------------FN_DYNVARS_001_03------------------------#' '#--------------------FN_DYNVARS_001_03------------------------#'
SET @@global.table_open_cache = 8; SET @@global.table_open_cache = 8;
Warnings: Warnings:
...@@ -101,13 +92,8 @@ SELECT @@table_open_cache = @@global.table_open_cache ; ...@@ -101,13 +92,8 @@ SELECT @@table_open_cache = @@global.table_open_cache ;
'#---------------------FN_DYNVARS_001_11----------------------#' '#---------------------FN_DYNVARS_001_11----------------------#'
SET table_open_cache = 8; SET table_open_cache = 8;
ERROR HY000: Variable 'table_open_cache' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'table_open_cache' is a GLOBAL variable and should be set with SET GLOBAL
SET global.table_open_cache = 10;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'table_open_cache = 10' at line 1
SELECT global.table_open_cache ; SELECT global.table_open_cache ;
ERROR 42S02: Unknown table 'global' in field list ERROR 42S02: Unknown table 'global' in field list
SELECT table_open_cache = @@session.table_open_cache ; SELECT table_open_cache = @@session.table_open_cache ;
ERROR 42S22: Unknown column 'table_open_cache' in 'field list' ERROR 42S22: Unknown column 'table_open_cache' in 'field list'
SET @@global.table_open_cache = @start_value; SET @@global.table_open_cache = @start_value;
SELECT @@global.table_open_cache ;
@@global.table_open_cache
421
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
# Scope: GLOBAL # # Scope: GLOBAL #
# Access Type: Dynamic # # Access Type: Dynamic #
# Data Type: numeric # # Data Type: numeric #
# Default Value: 400 # # Default Value: 400 #
# Range: 64-524288 # # Range: 64-524288 #
# # # #
# # # #
# Creation Date: 2008-02-13 # # Creation Date: 2008-02-13 #
...@@ -35,18 +35,6 @@ ...@@ -35,18 +35,6 @@
########################################################################## ##########################################################################
SET @start_value = @@global.table_open_cache ; SET @start_value = @@global.table_open_cache ;
SELECT @start_value;
--echo '#--------------------FN_DYNVARS_001_01------------------------#'
########################################################################
# Display the DEFAULT value of table_open_cache #
########################################################################
SET @@global.table_open_cache = 99;
SET @@global.table_open_cache = DeFAULT;
SELECT @@global.table_open_cache;
--echo '#---------------------FN_DYNVARS_001_02-------------------------#' --echo '#---------------------FN_DYNVARS_001_02-------------------------#'
############################################### ###############################################
...@@ -54,7 +42,7 @@ SELECT @@global.table_open_cache; ...@@ -54,7 +42,7 @@ SELECT @@global.table_open_cache;
############################################### ###############################################
SET @@global.table_open_cache = Default; SET @@global.table_open_cache = Default;
SELECT @@global.table_open_cache = 400; SELECT @@global.table_open_cache > 0;
--echo '#--------------------FN_DYNVARS_001_03------------------------#' --echo '#--------------------FN_DYNVARS_001_03------------------------#'
######################################################################## ########################################################################
...@@ -152,8 +140,6 @@ SELECT @@table_open_cache = @@global.table_open_cache ; ...@@ -152,8 +140,6 @@ SELECT @@table_open_cache = @@global.table_open_cache ;
--Error ER_GLOBAL_VARIABLE --Error ER_GLOBAL_VARIABLE
SET table_open_cache = 8; SET table_open_cache = 8;
--Error ER_PARSE_ERROR
SET global.table_open_cache = 10;
--Error ER_UNKNOWN_TABLE --Error ER_UNKNOWN_TABLE
SELECT global.table_open_cache ; SELECT global.table_open_cache ;
--Error ER_BAD_FIELD_ERROR --Error ER_BAD_FIELD_ERROR
...@@ -165,10 +151,7 @@ SELECT table_open_cache = @@session.table_open_cache ; ...@@ -165,10 +151,7 @@ SELECT table_open_cache = @@session.table_open_cache ;
############################## ##############################
SET @@global.table_open_cache = @start_value; SET @@global.table_open_cache = @start_value;
SELECT @@global.table_open_cache ;
################################################################## ##################################################################
# END OF table_open_cache TESTS # # END OF table_open_cache TESTS #
################################################################## ##################################################################
...@@ -879,7 +879,7 @@ MYSQL_FIELD *MYSQLC::GetNextField(void) ...@@ -879,7 +879,7 @@ MYSQL_FIELD *MYSQLC::GetNextField(void)
PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
{ {
PCSZ fmt; PCSZ fmt;
char *name, v; char *name, v= 0;
int n; int n;
bool uns; bool uns;
PCOLRES *pcrp, crp; PCOLRES *pcrp, crp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment