Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix | Fix possible server connection leak if an exception occurs in pooling layer #890

Merged
merged 8 commits into from
Apr 14, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,14 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio

CheckPoolBlockingPeriod(e);

// Close associated Parser if connection already established.
if (newObj != null && newObj.IsConnectionAlive())
{
newObj.Dispose();
}

newObj = null; // set to null, so we do not return bad new object

// Failed to create instance
_resError = e;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,14 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
throw;
}

// Close associated Parser if connection already established.
if (newObj != null && newObj.IsConnectionAlive())
{
newObj.Dispose();
}

newObj = null; // set to null, so we do not return bad new object

// Failed to create instance
_resError = e;

Expand Down