Skip to content

Commit

Permalink
fix dispose issue
Browse files Browse the repository at this point in the history
  • Loading branch information
XieJJ99 authored Oct 25, 2016
1 parent 98c4862 commit 417a092
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Brotli.NET/Brotli.NET/Implement/BrotliStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
_stream.Dispose();
_intermediateStream.Dispose();
Marshal.FreeHGlobal(_ptrInputBuffer);
Marshal.FreeHGlobal(_ptrOutputBuffer);
if (_ptrInputBuffer!=IntPtr.Zero) Marshal.FreeHGlobal(_ptrInputBuffer);
if (_ptrOutputBuffer != IntPtr.Zero) Marshal.FreeHGlobal(_ptrOutputBuffer);
_managedBuffer = null;
_ptrInputBuffer = IntPtr.Zero;
_ptrOutputBuffer = IntPtr.Zero;
}

public void TruncateBeginning(MemoryStream ms, int numberOfBytesToRemove)
Expand Down

0 comments on commit 417a092

Please sign in to comment.