...
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(). If bar() does not produce any side effects, then it can be removed.
| Code Block | ||
|---|---|---|
| ||
int *p1, *p2;
p1 = foo();
p2 = NULL;
{{bar();}} /* Removable if bar() does not have any side effects */
if(baz())
return p1;
else
p2 = p1;
return p2;
|
...