bp74 / Zstandard.Net

A Zstandard wrapper for .Net
Other
135 stars 26 forks source link

Unmanaged resource leak #16

Open Brain2000 opened 5 years ago

Brain2000 commented 5 years ago

If you only call Dispose( ) without Close( ) first, the ZSTD_freeCCtx( ) function is not called, eventually leading to an out of memory error after creating and disposing of about 200 compression streams.

Also, if the Close( ) function were to throw an error while flushing the ZSTD stream, the memory would also not be released.

I created a pull request that I believe corrects the issue without changing any behavior.

EamonNerbonne commented 5 years ago

For linkability: #15