Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Bogatov <egorbo@gmail.com>2019-08-06 15:53:24 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-08-06 15:53:24 +0300
commit0fbc5d83159b83d5e07ef26f6c67e3ee78f3460b (patch)
tree78659d751d52a58866be9446662a55a5b41168a6 /mcs/class/System
parent85296ef1be7bb34c1c92953ca66a026e5dcd0771 (diff)
DeflateStream: check IsInvalid before disposing (#16048)
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/System.IO.Compression/DeflateStream.cs6
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 ();
}
}