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.
@@ -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;
