Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 (see \[[DCL30-C. Do not refer to an object outside of its lifetime]\]).

Code Block
bgColor#FFCCCC
int *p1, *p2;
p1 = foo();
p2 = bar();

if (baz())
   return p1;
else
    p2 = p1;
return p2;

...

Code Block
bgColor#ccccff
int *p1 = foo();
int *p2 = NULL;
bar(); /* Removable if bar() does not produce any side-effects */
if (baz()) {
   return p1;
}
else {
  p2 = p1;
}
return p2;

Risk Assessment

The presence of unused Unused values may indicate significant logic errors, possibly resulting in a denial of service condition.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

MSC13-A

1 (low)

1 (unlikely)

2 (medium)

P2

L3

...