From e4793a489e49df78a0440c78f7aa18df2c16b418 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Sat, 19 Jan 2019 23:26:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E6=98=93=E5=B4=A9=E8=80=8C?= =?UTF-8?q?=E5=BC=83=E7=94=A8lz4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃,原因不明。 2、修复内存泄漏缺陷,在throw "Bad Buffer"的情况需要释放申请的内存。 --- ReadMe.txt | 6 ++++++ client/IOCPClient.cpp | 2 ++ client/ScreenManager.cpp | 6 ++++++ client/StdAfx.h | 2 +- server/2015Remote/IOCPServer.cpp | 2 ++ server/2015Remote/stdafx.h | 2 +- 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 43eda75..a74f078 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -109,3 +109,9 @@ 1、整理部分垃圾代码。 2、发布V1.0.0.2。 + +2018.1.19 + +1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃,原因不明。 + +2、修复内存泄漏缺陷,在throw "Bad Buffer"的情况需要释放申请的内存。 diff --git a/client/IOCPClient.cpp b/client/IOCPClient.cpp index d8d13ea..968d961 100644 --- a/client/IOCPClient.cpp +++ b/client/IOCPClient.cpp @@ -253,6 +253,8 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength) } else{ printf("[ERROR] uncompress failed \n"); + delete [] CompressedBuffer; + delete [] DeCompressedBuffer; throw "Bad Buffer"; } diff --git a/client/ScreenManager.cpp b/client/ScreenManager.cpp index 50562b3..f957558 100644 --- a/client/ScreenManager.cpp +++ b/client/ScreenManager.cpp @@ -43,7 +43,13 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam) clock_t last = clock(); This->SendFirstScreen(); +#if USING_ZLIB + const int fps = 8;// ֡ +#elif USING_LZ4 const int fps = 12;// ֡ +#else + const int fps = 8;// ֡ +#endif const int sleep = 1000 / fps;// ʱ䣨ms timeBeginPeriod(1); while (This->m_bIsWorking) diff --git a/client/StdAfx.h b/client/StdAfx.h index 0fd3502..67f0dd3 100644 --- a/client/StdAfx.h +++ b/client/StdAfx.h @@ -11,7 +11,7 @@ #if !USING_ZLIB // ǷʹLZ4 -#define USING_LZ4 1 +#define USING_LZ4 0 #endif #if _MSC_VER > 1000 diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp index 6716c40..77bca56 100644 --- a/server/2015Remote/IOCPServer.cpp +++ b/server/2015Remote/IOCPServer.cpp @@ -479,6 +479,8 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans m_NotifyProc(ContextObject); //֪ͨ }else{ OutputDebugStringA("[ERROR] uncompress failed \n"); + delete [] CompressedBuffer; + delete [] DeCompressedBuffer; throw "Bad Buffer"; } delete [] CompressedBuffer; diff --git a/server/2015Remote/stdafx.h b/server/2015Remote/stdafx.h index 491c8ca..b4d90e8 100644 --- a/server/2015Remote/stdafx.h +++ b/server/2015Remote/stdafx.h @@ -10,7 +10,7 @@ #if !USING_ZLIB // ǷʹLZ4 -#define USING_LZ4 1 +#define USING_LZ4 0 #endif #ifndef _SECURE_ATL