summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ps.result15
-rw-r--r--mysql-test/r/symlink.result15
-rw-r--r--mysql-test/t/ps.test18
-rw-r--r--mysql-test/t/symlink.test19
-rw-r--r--mysql-test/valgrind.supp437
-rw-r--r--sql/field_conv.cc4
-rw-r--r--sql/mysqld.cc3
-rw-r--r--vio/viosslfactories.c4
8 files changed, 482 insertions, 33 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 0d6b01f3481..d8a75737efc 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1087,19 +1087,4 @@ t2 CREATE TABLE `t2` (
drop database mysqltest;
deallocate prepare stmt1;
deallocate prepare stmt2;
-execute stmt;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c` char(10) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
-drop table t1;
-execute stmt;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c` char(10) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
-drop table t1;
-deallocate prepare stmt;
End of 4.1 tests.
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index bc7d3275754..9b21dc7e952 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -123,4 +123,19 @@ select * from t1;
a
42
drop table t1;
+execute stmt;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
+drop table t1;
+execute stmt;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
+drop table t1;
+deallocate prepare stmt;
End of 4.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index c963e59110f..a0133897f50 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1128,22 +1128,4 @@ drop database mysqltest;
deallocate prepare stmt1;
deallocate prepare stmt2;
#
-# CREATE TABLE with DATA DIRECTORY option
-#
-# Protect ourselves from data left in tmp/ by a previos possibly failed
-# test
---system rm -f $MYSQLTEST_VARDIR/tmp/t1.*
---disable_query_log
-eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
---enable_query_log
-execute stmt;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
-drop table t1;
-execute stmt;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
-drop table t1;
-deallocate prepare stmt;
-#
--echo End of 4.1 tests.
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index 23fd779ee13..010ef496399 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -170,4 +170,23 @@ connection default;
select * from t1;
drop table t1;
+#
+# CREATE TABLE with DATA DIRECTORY option
+#
+# Protect ourselves from data left in tmp/ by a previos possibly failed
+# test
+--system rm -f $MYSQLTEST_VARDIR/tmp/t1.*
+--disable_query_log
+eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
+--enable_query_log
+execute stmt;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show create table t1;
+drop table t1;
+execute stmt;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show create table t1;
+drop table t1;
+deallocate prepare stmt;
+
--echo End of 4.1 tests
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
new file mode 100644
index 00000000000..716dca491ce
--- /dev/null
+++ b/mysql-test/valgrind.supp
@@ -0,0 +1,437 @@
+#
+# Suppress some common (not fatal) errors in system libraries found by valgrind
+#
+
+#
+# Pthread doesn't free all thread specific memory before program exists
+#
+{
+ pthread allocate_tls memory loss
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:allocate_stack
+ fun:pthread_create*
+}
+
+{
+ pthread allocate_tls memory loss
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
+
+{
+ pthread allocate_dtv memory loss
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls_storage
+ fun:__GI__dl_allocate_tls
+ fun:pthread_create
+}
+
+{
+ pthread allocate_dtv memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls
+ fun:pthread_create*
+}
+
+{
+ pthread memalign memory loss
+ Memcheck:Leak
+ fun:memalign
+ fun:_dl_allocate_tls_storage
+ fun:__GI__dl_allocate_tls
+ fun:pthread_create
+}
+
+{
+ pthread pthread_key_create
+ Memcheck:Leak
+ fun:malloc
+ fun:*
+ fun:*
+ fun:pthread_key_create
+ fun:my_thread_global_init
+}
+
+{
+ pthread strstr uninit
+ Memcheck:Cond
+ fun:strstr
+ obj:/lib/tls/libpthread.so.*
+ obj:/lib/tls/libpthread.so.*
+ fun:call_init
+ fun:_dl_init
+ obj:/lib/ld-*.so
+}
+
+{
+ pthread errno
+ Memcheck:Leak
+ fun:calloc
+ fun:_dlerror_run
+ fun:dlsym
+ fun:__errno_location
+}
+
+
+#
+# Warnings in libz becasue it works with aligned memory(?)
+#
+
+{
+ libz tr_flush_block
+ Memcheck:Cond
+ fun:_tr_flush_block
+ fun:deflate_slow
+ fun:deflate
+ fun:do_flush
+ fun:gzclose
+}
+
+{
+ libz tr_flush_block2
+ Memcheck:Cond
+ fun:_tr_flush_block
+ fun:deflate_slow
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz longest_match
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:do_flush
+}
+
+{
+ libz longest_match2
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz longest_match 3
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:gzclose
+}
+
+{
+ libz longest_match 4
+ Memcheck:Cond
+ fun:longest_match
+ fun:deflate_slow
+ fun:deflate
+ fun:gzflush
+}
+
+{
+ libz deflate
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ fun:compress2
+}
+
+{
+ libz deflate2
+ Memcheck:Cond
+ obj:*/libz.so.*
+ obj:*/libz.so.*
+ fun:deflate
+ obj:*/libz.so.*
+ fun:gzflush
+}
+
+
+#
+# Warning from my_thread_init becasue mysqld dies before kill thread exists
+#
+
+{
+ my_thread_init kill thread memory loss second
+ Memcheck:Leak
+ fun:calloc
+ fun:my_thread_init
+ fun:kill_server_thread
+}
+
+#
+# Leaks reported in _dl_* internal functions on Linux amd64 / glibc2.3.2.
+#
+
+{
+ _dl_start invalid write8
+ Memcheck:Addr8
+ fun:_dl_start
+}
+
+{
+ _dl_start invalid write4
+ Memcheck:Addr4
+ fun:_dl_start
+}
+
+{
+ _dl_start/_dl_setup_hash invalid read8
+ Memcheck:Addr8
+ fun:_dl_setup_hash
+ fun:_dl_start
+}
+
+{
+ _dl_sysdep_start invalid write8
+ Memcheck:Addr8
+ fun:_dl_sysdep_start
+}
+
+{
+ _dl_init invalid write8
+ Memcheck:Addr8
+ fun:_dl_init
+}
+
+{
+ _dl_init invalid write4
+ Memcheck:Addr4
+ fun:_dl_init
+}
+
+{
+ _dl_init/_dl_init invalid read8
+ Memcheck:Addr8
+ fun:_dl_debug_initialize
+ fun:_dl_init
+}
+
+{
+ _dl_init/_dl_debug_state invalid read8
+ Memcheck:Addr8
+ fun:_dl_debug_state
+ fun:_dl_init
+}
+
+{
+ init invalid write8
+ Memcheck:Addr8
+ fun:init
+}
+
+{
+ fixup invalid write8
+ Memcheck:Addr8
+ fun:fixup
+}
+
+{
+ fixup/_dl_lookup_versioned_symbol invalid read8
+ Memcheck:Addr8
+ fun:_dl_lookup_versioned_symbol
+ fun:fixup
+}
+
+{
+ _dl_runtime_resolve invalid read8
+ Memcheck:Addr8
+ fun:_dl_runtime_resolve
+}
+
+{
+ __libc_start_main invalid write8
+ Memcheck:Addr8
+ fun:__libc_start_main
+}
+
+{
+ __libc_start_main/__sigjmp_save invalid write4
+ Memcheck:Addr4
+ fun:__sigjmp_save
+ fun:__libc_start_main
+}
+
+#
+# These seem to be libc threading stuff, not related to MySQL code (allocations
+# during pthread_exit()). Googling shows other projects also using these
+# suppressions.
+#
+# Note that these all stem from pthread_exit() deeper in the call stack, but
+# Valgrind only allows the top four calls in the suppressions.
+#
+
+{
+ libc pthread_exit 1
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_new_object
+ fun:_dl_map_object_from_fd
+ fun:_dl_map_object
+}
+
+{
+ libc pthread_exit 2
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_map_object
+ fun:dl_open_worker
+ fun:_dl_catch_error
+}
+
+{
+ libc pthread_exit 3
+ Memcheck:Leak
+ fun:malloc
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+}
+
+{
+ libc pthread_exit 4
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_check_map_versions
+ fun:dl_open_worker
+ fun:_dl_catch_error
+}
+
+{
+ libc pthread_exit 5
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_new_object
+ fun:_dl_map_object_from_fd
+ fun:_dl_map_object
+}
+
+
+
+#
+# This is seen internally in the system libraries on 64-bit RHAS3.
+#
+
+{
+ __lll_mutex_unlock_wake uninitialized
+ Memcheck:Param
+ futex(utime)
+ fun:__lll_mutex_unlock_wake
+}
+
+#
+# BUG#19940: NDB sends uninitialized parts of field buffers across the wire.
+# This is "works as designed"; the uninitialized part is not used at the
+# other end (but Valgrind cannot see this).
+#
+{
+ bug19940
+ Memcheck:Param
+ socketcall.sendto(msg)
+ fun:send
+ fun:_ZN15TCP_Transporter6doSendEv
+ fun:_ZN19TransporterRegistry11performSendEv
+ fun:_ZN19TransporterRegistry14forceSendCheckEi
+}
+
+{
+ OpenSSL_1
+ Memcheck:Cond
+ fun:BN_num_bits_word
+ fun:BN_num_bits
+ fun:BN_mod_exp_mont_consttime
+ fun:BN_mod_exp_mont
+ obj:*libcrypto.so.*
+ obj:*libcrypto.so.*
+ fun:DH_generate_key
+ fun:ssl3_ctx_ctrl
+ fun:SSL_CTX_ctrl
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
+
+{
+ OpenSSL_2
+ Memcheck:Value4
+ fun:BN_num_bits_word
+ fun:BN_num_bits
+ fun:BN_mod_exp_mont_consttime
+ fun:BN_mod_exp_mont
+ obj:*libcrypto.so.*
+ obj:*libcrypto.so.*
+ fun:DH_generate_key
+ fun:ssl3_ctx_ctrl
+ fun:SSL_CTX_ctrl
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
+
+{
+ OpenSSL_3
+ Memcheck:Value4
+ fun:BN_mod_exp_mont_consttime
+ fun:BN_mod_exp_mont
+ obj:*libcrypto.so.*
+ obj:*libcrypto.so.*
+ fun:DH_generate_key
+ fun:ssl3_ctx_ctrl
+ fun:SSL_CTX_ctrl
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
+
+{
+ OpenSSL_4
+ Memcheck:Cond
+ fun:BN_bin2bn
+ obj:*libcrypto.so.*
+ obj:*libcrypto.so.*
+ fun:DH_generate_key
+ fun:ssl3_ctx_ctrl
+ fun:SSL_CTX_ctrl
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
+
+{
+ OpenSSL_5
+ Memcheck:Leak
+ fun:realloc
+ obj:*libcrypto.so.*
+ fun:CRYPTO_realloc
+ fun:lh_insert
+ fun:OBJ_NAME_add
+ fun:EVP_add_cipher
+ fun:OpenSSL_add_all_ciphers
+ fun:OPENSSL_add_all_algorithms_noconf
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
+
+{
+ OpenSSL_6
+ Memcheck:Leak
+ fun:malloc
+ obj:*libcrypto.so.*
+ fun:CRYPTO_malloc
+ fun:lh_new
+ fun:OBJ_NAME_init
+ fun:OBJ_NAME_add
+ fun:EVP_add_cipher
+ fun:SSL_library_init
+ fun:new_VioSSLAcceptorFd
+ fun:main
+}
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index d61b3735c91..59b550572c3 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -605,6 +605,10 @@ void field_conv(Field *to,Field *from)
from->charset() == to->charset() &&
to->table->db_low_byte_first == from->table->db_low_byte_first)
{ // Identical fields
+#ifdef HAVE_purify
+ /* This may happen if one does 'UPDATE ... SET x=x' */
+ if (to->ptr != from->ptr)
+#endif
memcpy(to->ptr,from->ptr,to->pack_length());
return;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d9962eec4c1..0cccf097132 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1070,7 +1070,10 @@ void clean_up(bool print_message)
#endif
#ifdef HAVE_OPENSSL
if (ssl_acceptor_fd)
+ {
+ SSL_CTX_free(ssl_acceptor_fd->ssl_context);
my_free((gptr) ssl_acceptor_fd, MYF(MY_ALLOW_ZERO_PTR));
+ }
#endif /* HAVE_OPENSSL */
#ifdef USE_REGEX
my_regex_end();
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 46306cf48bb..1ac5d96d158 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -289,6 +289,8 @@ new_VioSSLConnectorFd(const char* key_file,
DBUG_RETURN(ptr);
ctor_failure:
DBUG_PRINT("exit", ("there was an error"));
+ if (ptr->ssl_context)
+ SSL_CTX_free(ptr->ssl_context);
my_free((gptr)ptr,MYF(0));
DBUG_RETURN(0);
}
@@ -390,6 +392,8 @@ new_VioSSLAcceptorFd(const char *key_file,
ctor_failure:
DBUG_PRINT("exit", ("there was an error"));
+ if (ptr->ssl_context)
+ SSL_CTX_free(ptr->ssl_context);
my_free((gptr) ptr,MYF(0));
DBUG_RETURN(0);
}