Skip to content

Commit

Permalink
Fix memory leak in PreprocessStreamMessage (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonnern authored Mar 20, 2024
1 parent 85a43e8 commit 15aae9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Huobi.Net/Clients/SpotApi/HuobiSocketClientSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public override ReadOnlyMemory<byte> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override ReadOnlyMemory<byte> 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;
Expand Down

0 comments on commit 15aae9a

Please sign in to comment.