Fixed clang analyzer false positive memory leaks.
Added a justification for each #ifndef __clang_analyzer__
This commit is contained in:
Родитель
d5720b7999
Коммит
2e5fd8d16b
|
@ -845,7 +845,13 @@ static UINT printer_free(DEVICE* device)
|
|||
{
|
||||
error = GetLastError();
|
||||
WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"", error);
|
||||
|
||||
/* The analyzer is confused by this premature return value.
|
||||
* Since this case can not be handled gracefully silence the
|
||||
* analyzer here. */
|
||||
#ifndef __clang_analyzer__
|
||||
return error;
|
||||
#endif
|
||||
}
|
||||
|
||||
while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL)
|
||||
|
|
|
@ -1140,8 +1140,13 @@ BOOL FindClose(HANDLE hFindFile)
|
|||
{
|
||||
WIN32_FILE_SEARCH* pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
|
||||
|
||||
/* Since INVALID_HANDLE_VALUE != NULL the analyzer guesses that there
|
||||
* is a initialized HANDLE that is not freed properly.
|
||||
* Disable this return to stop confusing the analyzer. */
|
||||
#ifndef __clang_analyzer__
|
||||
if (!pFileSearch || (pFileSearch == INVALID_HANDLE_VALUE))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
free(pFileSearch->lpPath);
|
||||
free(pFileSearch->lpPattern);
|
||||
|
|
|
@ -246,8 +246,13 @@ static BOOL NamedPipeCloseHandle(HANDLE handle)
|
|||
{
|
||||
WINPR_NAMED_PIPE* pNamedPipe = (WINPR_NAMED_PIPE*)handle;
|
||||
|
||||
/* This check confuses the analyzer. Since not all handle
|
||||
* types are handled here, it guesses that the memory of a
|
||||
* NamedPipeHandle may leak. */
|
||||
#ifndef __clang_analyzer__
|
||||
if (!NamedPipeIsHandled(handle))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (pNamedPipe->pfnUnrefNamedPipe)
|
||||
pNamedPipe->pfnUnrefNamedPipe(pNamedPipe);
|
||||
|
|
Загрузка…
Ссылка в новой задаче