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'.
This commit is contained in:
Ilya Shipitsin 2017-05-01 16:40:02 +05:00
parent 38ca328739
commit c78a2f0333
2 changed files with 6 additions and 5 deletions

View File

@ -112,6 +112,10 @@ static BOOL drive_file_remove_dir(const WCHAR* path)
WCHAR* fullpath; WCHAR* fullpath;
WCHAR* path_slash; WCHAR* path_slash;
UINT32 base_path_length; UINT32 base_path_length;
if (!path)
return FALSE;
base_path_length = _wcslen(path) * 2; base_path_length = _wcslen(path) * 2;
path_slash = (WCHAR*)calloc(1, base_path_length + sizeof(WCHAR) * 3); 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; return FALSE;
} }
if (!path)
return FALSE;
CopyMemory(path_slash, path, base_path_length); CopyMemory(path_slash, path, base_path_length);
path_slash[base_path_length / 2] = '/'; path_slash[base_path_length / 2] = '/';
path_slash[base_path_length / 2 + 1] = '*'; path_slash[base_path_length / 2 + 1] = '*';

View File

@ -192,7 +192,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
{ {
if (status == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) 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; return 1;
} }
@ -482,4 +482,4 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
return 0; return 0;
} }
#endif #endif