Skip to content

Commit

Permalink
Fix sqlite3_stmt leak
Browse files Browse the repository at this point in the history
They would eventually get freed with the connection, but this will free them sooner when an undisposed reader is finalized and the connection is still open.

Fixes #351
  • Loading branch information
bricelam committed Apr 4, 2017
1 parent 5b38cdd commit 248e66a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Microsoft.Data.Sqlite.Core/SqliteDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ public override void Close()
/// </param>
protected override void Dispose(bool disposing)
{
if (!disposing)
{
return;
}

if (_stmt != null)
{
_stmt.Dispose();
Expand All @@ -191,6 +186,11 @@ protected override void Dispose(bool disposing)
_stmtQueue.Dequeue().stmt.Dispose();
}

if (!disposing)
{
return;
}

_closed = true;

if (_closeConnection)
Expand Down

0 comments on commit 248e66a

Please sign in to comment.