From 0130adf3f2d1631490768f170c282500b836cad7 Mon Sep 17 00:00:00 2001 From: AdmAlexus Date: Sat, 28 Oct 2017 22:06:45 +0500 Subject: [PATCH] Fix V3074, V3114 warnings from PVS-Studio Static Analyzer Hello. I'm a member of the Pinguem.ru competition on finding errors in open source projects. A bug, found using PVS-Studio. Warnings: V3074 The 'ISocket' class contains 'Dispose' method. Consider making it implement 'IDisposable' interface. ISocket.cs 11 V3114 IDisposable object 'memoryStream' is not disposed before method returns. Hybi13Handler.cs 29 --- .gitignore | 1 + src/Fleck/Handlers/Hybi13Handler.cs | 4 +++- src/Fleck/Interfaces/ISocket.cs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8329d9fc..7812a966 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ artifacts src/CommonAssemblyInfo.cs *.dotCover *mm_cache.bin +src/.vs/Fleck/v15/sqlite3/storage.ide diff --git a/src/Fleck/Handlers/Hybi13Handler.cs b/src/Fleck/Handlers/Hybi13Handler.cs index 20d633f3..7425b8a6 100644 --- a/src/Fleck/Handlers/Hybi13Handler.cs +++ b/src/Fleck/Handlers/Hybi13Handler.cs @@ -44,7 +44,9 @@ public static byte[] FrameData(byte[] payload, FrameType frameType) } memoryStream.Write(payload, 0, payload.Length); - + + memoryStream.Dispose(); + return memoryStream.ToArray(); } diff --git a/src/Fleck/Interfaces/ISocket.cs b/src/Fleck/Interfaces/ISocket.cs index b6481a0a..a058e4db 100644 --- a/src/Fleck/Interfaces/ISocket.cs +++ b/src/Fleck/Interfaces/ISocket.cs @@ -8,7 +8,7 @@ namespace Fleck { - public interface ISocket + public interface ISocket : IDisposable { bool Connected { get; } string RemoteIpAddress { get; }