...
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. (see See guideline DCL30-C. Declare objects with appropriate storage durations.).
Code Block | ||
---|---|---|
| ||
int *p1, *p2; p1 = foo(); p2 = bar(); if (baz()) { return p1; } else { p2 = p1; } return p2; |
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MSC13-C | low | unlikely | medium | P2 | L3 |
Automated Detection
The LDRA tool suite Version 7.6.0 can detect violations of this recommendation.
...
Tool | Version | Checker | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
| ||||||||||||
|
|
|
|
...
|
|
|
|
...
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Other Languages
Related Guidelines
This rule appears in the C++ Secure Coding Standard as : MSC13-CPP. Detect and remove unused values.
Bibliography
Wiki Markup |
---|
\[[Coverity 072007|AA. Bibliography#Coverity 07]\] \[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "BRS Leveraging human experience," "KOA Likely incorrect expressions," "XYQ Dead and Deactivated Code," and "XYR Unused Variable" |
...