Ignore INVALID_HANDLE_VALUE during clang scanbuild runs.

The value INVALID_HANDLE_VALUE could in theory be a valid memory address,
so the analyzer is confused and thinks either we have a memroy leak
or we try to free a fixed address.
This commit is contained in:
Armin Novak
2019-02-21 12:20:25 +01:00
parent 41d382569c
commit 32e5407b43

View File

@@ -123,9 +123,16 @@ static INLINE BOOL winpr_Handle_GetInfo(HANDLE handle, ULONG* pType, WINPR_HANDL
{
WINPR_HANDLE* wHandle;
if (handle == NULL || handle == INVALID_HANDLE_VALUE)
if (handle == NULL)
return FALSE;
/* INVALID_HANDLE_VALUE is an invalid value for every handle, but it
* confuses the clang scanbuild analyzer. */
#ifndef __clang_analyzer__
if (handle == INVALID_HANDLE_VALUE)
return FALSE;
#endif
wHandle = (WINPR_HANDLE*) handle;
*pType = wHandle->Type;