mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #809 from geoffw0/enclosing
CPP: Small change to 'Resource not released in destructor'
This commit is contained in:
@@ -191,9 +191,7 @@ predicate freedInSameMethod(Resource r, Expr acquire) {
|
||||
exists(Expr releaseExpr, string kind |
|
||||
r.acquisitionWithRequiredKind(acquire, kind) and
|
||||
releaseExpr = r.getAReleaseExpr(kind) and
|
||||
releaseExpr.getEnclosingFunction().getEnclosingAccessHolder*() = acquire.getEnclosingFunction()
|
||||
// here, `getEnclosingAccessHolder*` allows us to go from a nested function or lambda
|
||||
// expression to the class method enclosing it.
|
||||
releaseExpr.getEnclosingElement+() = acquire.getEnclosingFunction()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user