Inconsistent operation on return value¶
ID: cpp/inconsistent-call-on-result
Kind: problem
Security severity:
Severity: warning
Precision: medium
Tags:
- reliability
- correctness
- statistical
- non-attributable
- external/cwe/cwe-252
Query suites:
- cpp-security-and-quality.qls
Click to see the query in the CodeQL repository
If the same operation (e.g. free
, delete
, close
, etc.) is usually performed on the result of a method call, then any instances where it is not performed may indicate misuse of the API and could cause resource leaks or other issues.
Recommendation¶
Examine the code to determine if the return value is treated correctly in this particular case.
References¶
Tutorialspoint - The C++ Programming Language: C++ Dynamic Memory
Common Weakness Enumeration: CWE-252.