diff options
author | Egor Bogatov <egorbo@gmail.com> | 2019-08-06 15:53:24 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-08-06 15:53:24 +0300 |
commit | 0fbc5d83159b83d5e07ef26f6c67e3ee78f3460b (patch) | |
tree | 78659d751d52a58866be9446662a55a5b41168a6 /mcs/class/System | |
parent | 85296ef1be7bb34c1c92953ca66a026e5dcd0771 (diff) |
DeflateStream: check IsInvalid before disposing (#16048)
Diffstat (limited to 'mcs/class/System')
-rw-r--r-- | mcs/class/System/System.IO.Compression/DeflateStream.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mcs/class/System/System.IO.Compression/DeflateStream.cs b/mcs/class/System/System.IO.Compression/DeflateStream.cs index c3c2f08902e..cf39171bc78 100644 --- a/mcs/class/System/System.IO.Compression/DeflateStream.cs +++ b/mcs/class/System/System.IO.Compression/DeflateStream.cs @@ -111,7 +111,7 @@ namespace System.IO.Compression if (disposing) GC.SuppressFinalize (this); - native.Dispose (disposing); + native?.Dispose (disposing); if (disposing && !disposed) { disposed = true; @@ -392,11 +392,11 @@ namespace System.IO.Compression io_buffer = null; - if (z_stream != null) { + if (z_stream != null && !z_stream.IsInvalid) { z_stream.Dispose(); } - if (data.IsAllocated) { + if (data != null && data.IsAllocated) { data.Free (); } } |