Merge pull request #17110 from geoffw0/memfree

C++: Improve cpp/memory-may-not-be-freed
This commit is contained in:
Geoffrey White
2024-07-31 15:59:42 +01:00
committed by GitHub
5 changed files with 84 additions and 2 deletions

View File

@@ -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, _)

View File

@@ -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.