From d8f7fb14259c24bb90d6b7368524e45e7a5ad409 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Dec 2005 16:48:37 +0100 Subject: WL#2930 mysqltest++ - Updated after valgrinding client/mysqltest.c: Move initialisation of dynamic strings to top of function so that variables are always inited before free The workaround for 15518 moved to last in function Add check for "--" comments without any comment,. to avoid read of uninit memory mysql-test/mysql-test-run.sh: Add printout of valgrind errors from mysqltest when test with valgrind has completed --- client/mysqltest.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'client') diff --git a/client/mysqltest.c b/client/mysqltest.c index 285aa0fe033..60dfb7a48a7 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2676,6 +2676,7 @@ int read_query(struct st_query** q_ptr) end: while (*p && my_isspace(charset_info, *p)) p++; + if (!(q->query_buf= q->query= my_strdup(p, MYF(MY_WME)))) die(NullS); @@ -3573,6 +3574,13 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command, cur_con->stmt= stmt; } + /* Init dynamic strings for warnings */ + if (!disable_warnings) + { + init_dynamic_string(&ds_prepare_warnings, NULL, 0, 256); + init_dynamic_string(&ds_execute_warnings, NULL, 0, 256); + } + /* Prepare the query */ @@ -3580,10 +3588,6 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command, { handle_error(query, command, mysql_stmt_errno(stmt), mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds); -#ifndef BUG15518_FIXED - mysql_stmt_close(stmt); - cur_con->stmt= NULL; -#endif goto end; } @@ -3592,12 +3596,7 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command, separate string */ if (!disable_warnings) - { - init_dynamic_string(&ds_prepare_warnings, NULL, 0, 256); - init_dynamic_string(&ds_execute_warnings, NULL, 0, 256); append_warnings(&ds_prepare_warnings, mysql); - } - /* No need to call mysql_stmt_bind_param() because we have no @@ -3724,6 +3723,10 @@ end: variable then can be used from the test case itself. */ var_set_errno(mysql_stmt_errno(stmt)); +#ifndef BUG15518_FIXED + mysql_stmt_close(stmt); + cur_con->stmt= NULL; +#endif DBUG_VOID_RETURN; } @@ -4050,6 +4053,7 @@ void get_query_type(struct st_query* q) q->type= Q_COMMENT; } else if (q->type == Q_COMMENT_WITH_COMMAND && + q->first_word_len && q->query[q->first_word_len-1] == ';') { /* -- cgit v1.2.1