diff --git a/Huobi.Net/Clients/SpotApi/HuobiSocketClientSpotApi.cs b/Huobi.Net/Clients/SpotApi/HuobiSocketClientSpotApi.cs index 16fc8d60..8ac879d6 100644 --- a/Huobi.Net/Clients/SpotApi/HuobiSocketClientSpotApi.cs +++ b/Huobi.Net/Clients/SpotApi/HuobiSocketClientSpotApi.cs @@ -79,7 +79,7 @@ public override ReadOnlyMemory PreprocessStreamMessage(WebSocketMessageTyp if (type != WebSocketMessageType.Binary) return data; - var decompressedStream = new MemoryStream(); + using var decompressedStream = new MemoryStream(); using var deflateStream = new GZipStream(new MemoryStream(data.ToArray()), CompressionMode.Decompress); deflateStream.CopyTo(decompressedStream); decompressedStream.Position = 0; diff --git a/Huobi.Net/Clients/UsdtMarginSwapApi/HuobiSocketClientUsdtMarginSwapApi.cs b/Huobi.Net/Clients/UsdtMarginSwapApi/HuobiSocketClientUsdtMarginSwapApi.cs index be6d8e76..ffbba6ff 100644 --- a/Huobi.Net/Clients/UsdtMarginSwapApi/HuobiSocketClientUsdtMarginSwapApi.cs +++ b/Huobi.Net/Clients/UsdtMarginSwapApi/HuobiSocketClientUsdtMarginSwapApi.cs @@ -46,7 +46,7 @@ public override ReadOnlyMemory PreprocessStreamMessage(WebSocketMessageTyp if (type != WebSocketMessageType.Binary) return data; - var decompressedStream = new MemoryStream(); + using var decompressedStream = new MemoryStream(); using var deflateStream = new GZipStream(new MemoryStream(data.ToArray()), CompressionMode.Decompress); deflateStream.CopyTo(decompressedStream); decompressedStream.Position = 0;