@@ -53,20 +53,27 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
53
53
* Holds if results call `operator new` check in `operator if`.
54
54
*/
55
55
predicate isExistsIfCondition ( ) {
56
- exists ( IfCompareWithZero ifc , AssignExpr aex , Initializer it |
56
+ exists ( IfCompareWithZero ifc |
57
57
// call `operator new` directly from the condition of `operator if`.
58
58
this = ifc .getCondition ( ) .getAChild * ( )
59
59
or
60
- // check results call `operator new` with variable appropriation
61
60
postDominates ( ifc , this ) and
62
- aex .getAChild ( ) = exp and
63
- ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( ) =
64
- aex .getLValue ( ) .( VariableAccess ) .getTarget ( )
65
- or
66
- // check results call `operator new` with declaration variable
67
- postDominates ( ifc , this ) and
68
- exp = it .getExpr ( ) and
69
- it .getDeclaration ( ) = ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( )
61
+ exists ( Variable v |
62
+ v = ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( ) and
63
+ (
64
+ exists ( AssignExpr aex |
65
+ // check results call `operator new` with variable appropriation
66
+ aex .getAChild ( ) = exp and
67
+ v = aex .getLValue ( ) .( VariableAccess ) .getTarget ( )
68
+ )
69
+ or
70
+ exists ( Initializer it |
71
+ // check results call `operator new` with declaration variable
72
+ exp = it .getExpr ( ) and
73
+ it .getDeclaration ( ) = v
74
+ )
75
+ )
76
+ )
70
77
)
71
78
}
72
79
0 commit comments