summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-11-30 18:44:51 +0200
committerMichael Widenius <monty@askmonty.org>2011-11-30 18:44:51 +0200
commit692fcba40397e71c08ed1bcf34d37283eee5a13e (patch)
tree35c9de70ca8c4dd775e83a35a374cb0f28c8bbdc /client
parentca5b1b54312cf9bc4a8252134874d82cf394eb48 (diff)
downloadmariadb-git-692fcba40397e71c08ed1bcf34d37283eee5a13e.tar.gz
Fixed compiler warnings and other bugs found by buildbot.
client/mysqltest.cc: Free mutex after usage (fixes valgrind warnings in embedded server) mysql-test/include/gis_keys.inc: Fixed failure in innodb.gis_test mysql-test/r/gis.result: Updated result mysql-test/suite/innodb/r/innodb_gis.result: Updated results mysql-test/suite/innodb/t/innodb_bug38231.test: Added handling of timeouts (happend on some servers in buildbot) mysql-test/suite/innodb_plugin/r/innodb_gis.result: Updated results mysql-test/suite/innodb_plugin/t/innodb.test: Use error names instead of numbers mysql-test/suite/innodb_plugin/t/innodb_misc1.test: This test requires utf8 mysql-test/suite/innodb_plugin/t/innodb_mysql.test: This test requires Xtradb sql/sql_base.cc: Don't print table names for placeholders. sql/sql_show.cc: Temporary fix: Save and restore db and table_name in mysqld_show_create (to get rid of valgrind warning) A better solution that needs to be investgated is to not change these fields in mysql_derived_prepare() sql/sql_view.cc: Fixed valgrind warning storage/xtradb/handler/ha_innodb.cc: Don't access THD directly
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 668d9ba45ba..a5d9fa677a1 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -262,7 +262,7 @@ struct st_connection
pthread_cond_t cond;
pthread_t tid;
int query_done;
- my_bool has_thread;
+ my_bool has_thread, mutex_inited;
#endif /*EMBEDDED_LIBRARY*/
};
@@ -776,10 +776,12 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len,
if (flags & QUERY_REAP_FLAG)
return mysql_send_query(cn->mysql, q, q_len);
- if (pthread_mutex_init(&cn->mutex, NULL) ||
- pthread_cond_init(&cn->cond, NULL))
+ if (!cn->mutex_inited &&
+ (pthread_mutex_init(&cn->mutex, NULL) ||
+ pthread_cond_init(&cn->cond, NULL)))
die("Error in the thread library");
+ cn->mutex_inited= 1;
cn->cur_query= q;
cn->cur_query_len= q_len;
cn->query_done= 0;
@@ -809,9 +811,20 @@ static void wait_query_thread_end(struct st_connection *con)
}
}
+static void free_embedded_data(struct st_connection *con)
+{
+ if (con->mutex_inited)
+ {
+ con->mutex_inited= 0;
+ pthread_mutex_destroy(&con->mutex);
+ pthread_cond_destroy(&con->cond);
+ }
+}
+
#else /*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(cn->mysql, q, q_len)
+#define free_embedded_data(next_con) do { } while(0)
#endif /*EMBEDDED_LIBRARY*/
@@ -1165,6 +1178,7 @@ void close_connections()
if (next_con->util_mysql)
mysql_close(next_con->util_mysql);
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
+ free_embedded_data(next_con);
}
my_free(connections, MYF(MY_WME));
DBUG_VOID_RETURN;
@@ -4988,6 +5002,7 @@ void do_close_connection(struct st_command *command)
mysql_close(con->mysql);
con->mysql= 0;
+ free_embedded_data(con);
if (con->util_mysql)
mysql_close(con->util_mysql);