diff options
author | unknown <msvensson@shellback.(none)> | 2007-01-26 11:30:54 +0100 |
---|---|---|
committer | unknown <msvensson@shellback.(none)> | 2007-01-26 11:30:54 +0100 |
commit | 82fd1703387dd2ca3fcff18938f9024bc9cee24a (patch) | |
tree | 7eab9ac618ca44b112fcbcc3ff5fb92e0101be7b /vio/vio.c | |
parent | 7d4477f866d26b8bd8e941e6484d843cc30c83c8 (diff) | |
download | mariadb-git-82fd1703387dd2ca3fcff18938f9024bc9cee24a.tar.gz |
Bug#25203 Mysql crashes when mysql_kill() is executed in a connection using SSL
- It's too early to free the SSL object in 'vio_ssl_close'. There
might still be a thread using or reading from it on platforms
where we need to close the active connection/socket in order
to break the read.
- Add new function 'vio_ssl_delete' and install it as the viodelete
function for SSL connections.
vio/vio.c:
Install 'vio_ssl_delete' as viodelete function for SSL connections
Cleanup 'vio_delete'
vio/vio_priv.h:
Add declaration of vio_ssl_delete
vio/viossl.c:
Add new function 'vio_ssl_delete' that takes care of freeing the memory
allocated by the SSL connection
Move the code to free the SSL object from vio_ssl_close
Diffstat (limited to 'vio/vio.c')
-rw-r--r-- | vio/vio.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/vio/vio.c b/vio/vio.c index 00b8964e30b..84b3e26fa52 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -86,7 +86,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, #ifdef HAVE_OPENSSL if (type == VIO_TYPE_SSL) { - vio->viodelete =vio_delete; + vio->viodelete =vio_ssl_delete; vio->vioerrno =vio_errno; vio->read =vio_ssl_read; vio->write =vio_ssl_write; @@ -220,17 +220,16 @@ Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_m #endif #endif + void vio_delete(Vio* vio) { - /* It must be safe to delete null pointers. */ - /* This matches the semantics of C++'s delete operator. */ - if (vio) - { - if (vio->type != VIO_CLOSED) - vio->vioclose(vio); - my_free((gptr) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((gptr) vio,MYF(0)); - } + if (!vio) + return; /* It must be safe to delete null pointers. */ + + if (vio->type != VIO_CLOSED) + vio->vioclose(vio); + my_free((gptr) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free((gptr) vio,MYF(0)); } |