From c78a2f0333901e7acf9bae957e8d3c93c98d9c38 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Mon, 1 May 2017 16:40:02 +0500 Subject: [PATCH] resolve issues identified by cppcheck [channels/drive/client/drive_file.c:125]: (error) Memory leak: path_slash [server/Windows/wf_dxgi.c:195]: (error) Invalid number of character '(' when these macros are defined: 'WITH_DXGI_1_2'. --- channels/drive/client/drive_file.c | 7 ++++--- server/Windows/wf_dxgi.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/channels/drive/client/drive_file.c b/channels/drive/client/drive_file.c index 036bb29df..a24ebcfc5 100644 --- a/channels/drive/client/drive_file.c +++ b/channels/drive/client/drive_file.c @@ -112,6 +112,10 @@ static BOOL drive_file_remove_dir(const WCHAR* path) WCHAR* fullpath; WCHAR* path_slash; UINT32 base_path_length; + + if (!path) + return FALSE; + base_path_length = _wcslen(path) * 2; path_slash = (WCHAR*)calloc(1, base_path_length + sizeof(WCHAR) * 3); @@ -121,9 +125,6 @@ static BOOL drive_file_remove_dir(const WCHAR* path) return FALSE; } - if (!path) - return FALSE; - CopyMemory(path_slash, path, base_path_length); path_slash[base_path_length / 2] = '/'; path_slash[base_path_length / 2 + 1] = '*'; diff --git a/server/Windows/wf_dxgi.c b/server/Windows/wf_dxgi.c index 61dd96322..5a18fb150 100644 --- a/server/Windows/wf_dxgi.c +++ b/server/Windows/wf_dxgi.c @@ -192,7 +192,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi) { if (status == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) { - WLog_ERR(TAG, "There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.")); + WLog_ERR(TAG, "There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again."); return 1; } @@ -482,4 +482,4 @@ int wf_dxgi_getInvalidRegion(RECT* invalid) return 0; } -#endif \ No newline at end of file +#endif