mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix use after free in mysqlxx::Pool::tryGet()
tryGet() created an Entry object that referenced a Connection, but then deleted the Connection just before the Entry went out of scope.
This commit is contained in:
parent
f96892d45c
commit
efa94c5735
@ -174,9 +174,11 @@ Pool::Entry Pool::tryGet()
|
||||
/// Fixme: There is a race condition here b/c we do not synchronize with Pool::Entry's copy-assignment operator
|
||||
if (connection_ptr->ref_count == 0)
|
||||
{
|
||||
Entry res(connection_ptr, this);
|
||||
if (res.tryForceConnected()) /// Tries to reestablish connection as well
|
||||
return res;
|
||||
{
|
||||
Entry res(connection_ptr, this);
|
||||
if (res.tryForceConnected()) /// Tries to reestablish connection as well
|
||||
return res;
|
||||
}
|
||||
|
||||
logger.debug("(%s): Idle connection to MySQL server cannot be recovered, dropping it.", getDescription());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user