mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Merge pull request #17110 from geoffw0/memfree
C++: Improve cpp/memory-may-not-be-freed
This commit is contained in:
@@ -39,7 +39,7 @@ predicate allocCallOrIndirect(Expr e) {
|
||||
allocCallOrIndirect(rtn.getExpr())
|
||||
or
|
||||
// return variable assigned with alloc
|
||||
exists(Variable v |
|
||||
exists(StackVariable v |
|
||||
v = rtn.getExpr().(VariableAccess).getTarget() and
|
||||
allocCallOrIndirect(v.getAnAssignedValue()) and
|
||||
not assignedToFieldOrGlobal(v, _)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Fixed false positives in the `cpp/memory-may-not-be-freed` ("Memory may not be freed") query involving class methods that returned an allocated field of that class being misidentified as allocators.
|
||||
Reference in New Issue
Block a user