Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Postcondition for possibly null pointer 'variable' requires it to be non-null (lifetime.1)
Remarks
Dereferencing a null pointer is a frequent problem in C and C++. We have several checks to deal with such problems. See this blog post for a comparison. When the analysis engine sees a potentially null pointer returned from a function that has a contract forbidding such operation, it will emit a C26825
warning. You can enable C26824 only for a more permissive analysis. This check only works on functions annotated using SAL annotations.
Example
void postcondition_conditional(int *q, _Outptr_ int** p) {
*p = q; // C26825 warning
}
To solve this warning, make sure there's no null pointer returned from the annotated function. Or, change the annotations to reflect the behavior of the function.