Commit bc324937 authored by unknown's avatar unknown

Remove valgrind and compiler warnings

Add function 'vio_end' that will cleanup resources allocated by vio and the components it uses.


include/violite.h:
  Import patch warnings.patch
libmysql/libmysql.c:
  Import patch warnings.patch
sql/mysqld.cc:
  Import patch warnings.patch
vio/test-ssl.c:
  Import patch warnings.patch
vio/test-sslclient.c:
  Import patch warnings.patch
vio/test-sslserver.c:
  Import patch warnings.patch
vio/vio.c:
  Import patch warnings.patch
vio/viosslfactories.c:
  Import patch warnings.patch
parent c593d1f1
...@@ -129,6 +129,8 @@ int vio_write_shared_memory(Vio *vio, const gptr buf, int size); ...@@ -129,6 +129,8 @@ int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
int vio_close_shared_memory(Vio * vio); int vio_close_shared_memory(Vio * vio);
#endif #endif
void vio_end(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -193,7 +195,9 @@ struct st_vio ...@@ -193,7 +195,9 @@ struct st_vio
my_bool (*was_interrupted)(Vio*); my_bool (*was_interrupted)(Vio*);
int (*vioclose)(Vio*); int (*vioclose)(Vio*);
void (*timeout)(Vio*, unsigned int which, unsigned int timeout); void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
#ifdef HAVE_OPENSSL
void *ssl_arg; void *ssl_arg;
#endif
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
HANDLE handle_file_map; HANDLE handle_file_map;
char *handle_map; char *handle_map;
......
...@@ -188,6 +188,7 @@ void STDCALL mysql_server_end() ...@@ -188,6 +188,7 @@ void STDCALL mysql_server_end()
mysql_thread_end(); mysql_thread_end();
finish_client_errs(); finish_client_errs();
free_charsets(); free_charsets();
vio_end();
mysql_client_init= org_my_init_done= 0; mysql_client_init= org_my_init_done= 0;
#ifdef EMBEDDED_SERVER #ifdef EMBEDDED_SERVER
if (stderror_file) if (stderror_file)
......
...@@ -1136,6 +1136,8 @@ void clean_up(bool print_message) ...@@ -1136,6 +1136,8 @@ void clean_up(bool print_message)
my_free((gptr) ssl_acceptor_fd, MYF(0)); my_free((gptr) ssl_acceptor_fd, MYF(0));
} }
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
vio_end();
#ifdef USE_REGEX #ifdef USE_REGEX
my_regex_end(); my_regex_end();
#endif #endif
......
...@@ -57,8 +57,8 @@ main(int argc, char** argv) ...@@ -57,8 +57,8 @@ main(int argc, char** argv)
char* cipher=0; char* cipher=0;
int child_pid,sv[2]; int child_pid,sv[2];
my_bool unused; my_bool unused;
struct st_VioSSLAcceptorFd* ssl_acceptor=0; struct st_VioSSLFd* ssl_acceptor= 0;
struct st_VioSSLConnectorFd* ssl_connector=0; struct st_VioSSLFd* ssl_connector= 0;
Vio* client_vio=0, *server_vio=0; Vio* client_vio=0, *server_vio=0;
MY_INIT(argv[0]); MY_INIT(argv[0]);
DBUG_PROCESS(argv[0]); DBUG_PROCESS(argv[0]);
......
...@@ -46,7 +46,7 @@ main( int argc __attribute__((unused)), ...@@ -46,7 +46,7 @@ main( int argc __attribute__((unused)),
{ {
char client_key[] = "../SSL/client-key.pem", client_cert[] = "../SSL/client-cert.pem"; char client_key[] = "../SSL/client-key.pem", client_cert[] = "../SSL/client-cert.pem";
char ca_file[] = "../SSL/cacert.pem", *ca_path = 0, *cipher=0; char ca_file[] = "../SSL/cacert.pem", *ca_path = 0, *cipher=0;
struct st_VioSSLConnectorFd* ssl_connector=0; struct st_VioSSLFd* ssl_connector= 0;
struct sockaddr_in sa; struct sockaddr_in sa;
Vio* client_vio=0; Vio* client_vio=0;
int err; int err;
......
...@@ -44,7 +44,7 @@ fatal_error( const char* r) ...@@ -44,7 +44,7 @@ fatal_error( const char* r)
typedef struct { typedef struct {
int sd; int sd;
struct st_VioSSLAcceptorFd* ssl_acceptor; struct st_VioSSLFd* ssl_acceptor;
} TH_ARGS; } TH_ARGS;
static void static void
...@@ -82,7 +82,7 @@ main(int argc __attribute__((unused)), char** argv) ...@@ -82,7 +82,7 @@ main(int argc __attribute__((unused)), char** argv)
char ca_file[] = "../SSL/cacert.pem", char ca_file[] = "../SSL/cacert.pem",
*ca_path = 0, *ca_path = 0,
*cipher = 0; *cipher = 0;
struct st_VioSSLAcceptorFd* ssl_acceptor; struct st_VioSSLFd* ssl_acceptor;
pthread_t th; pthread_t th;
TH_ARGS th_args; TH_ARGS th_args;
......
...@@ -233,3 +233,16 @@ void vio_delete(Vio* vio) ...@@ -233,3 +233,16 @@ void vio_delete(Vio* vio)
my_free((gptr) vio,MYF(0)); my_free((gptr) vio,MYF(0));
} }
} }
/*
Cleanup memory allocated by vio or the
components below it when application finish
*/
void vio_end(void)
{
#ifdef HAVE_YASSL
yaSSL_CleanUp();
#endif
}
...@@ -220,7 +220,7 @@ static void check_ssl_init() ...@@ -220,7 +220,7 @@ static void check_ssl_init()
} }
/************************ VioSSLFd **********************************/ /************************ VioSSLFd **********************************/
struct st_VioSSLFd * static struct st_VioSSLFd *
new_VioSSLFd(const char *key_file, const char *cert_file, new_VioSSLFd(const char *key_file, const char *cert_file,
const char *ca_file, const char *ca_path, const char *ca_file, const char *ca_path,
const char *cipher, SSL_METHOD *method) const char *cipher, SSL_METHOD *method)
......
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