1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

CONC-622: Fix double free() if asnyc connect failed

If mysql_real_connect_start/cont failed, we need to
set async->pvio to zero after calling ma_pvio_close
to avoid double free() in mysql_close.
This commit is contained in:
Georg Richter
2022-12-27 14:36:44 +01:00
parent 57852875f1
commit da9bb98c0c
3 changed files with 57 additions and 0 deletions

View File

@@ -1727,6 +1727,14 @@ restart:
if (ma_pvio_connect(pvio, &cinfo) != 0)
{
ma_pvio_close(pvio);
if (mysql->options.extension && mysql->options.extension->async_context &&
mysql->options.extension->async_context->pvio)
{
/* pvio delegated to mysql->net.pvio by ma_net_init().
* invalidate the pvio pointer in the async context */
mysql->options.extension->async_context->pvio = NULL;
}
if (is_multi)
{
connect_attempts++;