Tomas Carnecky wrote:
- Another (missing NULL ptr check in LoadTypeLibEx) is right, but, I don't
think we want to add lots of missing NULL arg checks in the public API implementations. An application will never pass NULL to this function directly as otherwise it'd not work at all, so, a crash with a NULL arg here probably is revealing some other bug.
I'd rather it crashed cleanly in a debuggable way than silently return error code and continue, in other words ...
Is there a way to tell the code checker to skip the NULL check? Maybe there are flags like '__user' in the kernel source -- '__notnull'.
It's complaining because there is already a NULL check further down in the code, but we use the pointer without checking for NULL first.
In this case, dlls/oleaut32/typelib.c#343 calls TLB_ReadTypeLib with no null check, but there is a NULL check at #350.
So either:
1) We do need a NULL check, and we should check the pointer before using it
OR
2) We don't need a NULL check, and we should get rid of the unnecessary check.
If the function never checks that parameter for NULL, the checker won't complain about it.
Please be careful before writing off a warning from the checker as "not a bug".
Mike