Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdfdcbd

Browse files
authored
Update WrongInDetectingAndHandlingMemoryAllocationErrors.ql
1 parent 16d058f commit bdfdcbd

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

cpp/ql/src/experimental/Security/CWE/CWE-570/WrongInDetectingAndHandlingMemoryAllocationErrors.ql

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,8 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
4444
* Holds if handler `try ... catch` exists.
4545
*/
4646
predicate isExistsTryCatchBlock() {
47-
exists(TryStmt tb, AssignExpr aex, Initializer it |
48-
tb.getAChild*() = exp
49-
or
50-
exp = it.getExpr() and
51-
tb.getAChild*().(DeclStmt).getADeclaration() = it.getDeclaration()
52-
or
53-
aex.getAChild*() = exp and
54-
tb.getAChild*().(AssignExpr) = aex
47+
exists(TryStmt ts |
48+
this.getEnclosingStmt() = ts.getStmt().getAChild*()
5549
)
5650
}
5751

0 commit comments

Comments
 (0)