mirror of
https://github.com/github/codeql.git
synced 2026-04-18 13:34:02 +02:00
Merge pull request #5835 from hmakholm/hmakholm/pr/blowup-fix
CPP: fix semi-unused variables in WrongInDetectingAndHandlingMemoryAllocationErrors.q
This commit is contained in:
@@ -53,20 +53,27 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
|
||||
* Holds if results call `operator new` check in `operator if`.
|
||||
*/
|
||||
predicate isExistsIfCondition() {
|
||||
exists(IfCompareWithZero ifc, AssignExpr aex, Initializer it |
|
||||
exists(IfCompareWithZero ifc |
|
||||
// call `operator new` directly from the condition of `operator if`.
|
||||
this = ifc.getCondition().getAChild*()
|
||||
or
|
||||
// check results call `operator new` with variable appropriation
|
||||
postDominates(ifc, this) and
|
||||
aex.getAChild() = exp and
|
||||
ifc.getCondition().getAChild().(VariableAccess).getTarget() =
|
||||
aex.getLValue().(VariableAccess).getTarget()
|
||||
or
|
||||
// check results call `operator new` with declaration variable
|
||||
postDominates(ifc, this) and
|
||||
exp = it.getExpr() and
|
||||
it.getDeclaration() = ifc.getCondition().getAChild().(VariableAccess).getTarget()
|
||||
exists(Variable v |
|
||||
v = ifc.getCondition().getAChild().(VariableAccess).getTarget() and
|
||||
(
|
||||
exists(AssignExpr aex |
|
||||
// check results call `operator new` with variable appropriation
|
||||
aex.getAChild() = exp and
|
||||
v = aex.getLValue().(VariableAccess).getTarget()
|
||||
)
|
||||
or
|
||||
exists(Initializer it |
|
||||
// check results call `operator new` with declaration variable
|
||||
exp = it.getExpr() and
|
||||
it.getDeclaration() = v
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user