...
Wiki Markup |
---|
In this example, {{p2}} is assigned the value returned by {{bar()}}, but that value is never used. Note this example assumes that {{foo()}} and {{bar()}} return valid pointers \[[DCL30-C|DCL30-C. Do not refer to an object outside of its lifetime]\]. |
Code Block | ||
---|---|---|
| ||
int *p1, *p2;
p1 = foo();
p2 = bar();
if (baz())
return p1;
else
p2 = p1;
return p2;
|
...
Search for vulnerabilities resulting from the violation of this rule on the CERTwebsite CERT website.
References
Coverity 07 Coverity Prevent? User's Manual (3.3.0) (2007).