...
This example can be corrected many different ways depending on the intent of the programmer. In this compliant solution, p2 is initialized to NULL rather than the result of bar(). The call to bar() can be removed if if {{bar() does not produce any side-effects.
| Code Block | ||
|---|---|---|
| ||
int *p1, *p2; p1 = foo(); p2 = NULL; bar(); /* Removable if bar() does not haveproduce any side effects */ if(baz()) return p1; else p2 = p1; return p2; |
...