Skip to content

Commit d150c9a

Browse files
authored
Update DoubleRelease.ql
1 parent 8b0d5a2 commit d150c9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-675/DoubleRelease.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ predicate closeWithoutChangeBefore(FunctionCall fc) {
158158
/** Holds, if a sequential call of the specified functions is possible, via a higher-level function call. */
159159
predicate callInOtherFunctions(FunctionCall fc, FunctionCall fc1) {
160160
exists(FunctionCall fec1, FunctionCall fec2 |
161-
// fec1.getTarget() != fec2.getTarget() and
162161
fc.getEnclosingFunction() != fc1.getEnclosingFunction() and
163162
fec1 = fc.getEnclosingFunction().getACallToThisFunction() and
164163
fec2 = fc1.getEnclosingFunction().getACallToThisFunction() and
@@ -201,10 +200,12 @@ where
201200
not exists(CallMayNotReturn fctmp | fctmp = fc.getASuccessor*()) and
202201
not exists(IfStmt ifs | ifs.getCondition().getAChild*() = fc) and
203202
(
203+
// detecting a repeated call situation within one function
204204
closeReturn(fc) and
205205
closeWithoutChangeBefore(fc1) and
206206
callInOtherFunctions(fc, fc1)
207207
or
208+
// detection of repeated call in different functions
208209
interDoubleCloseFunctions(fc, fc1)
209210
) and
210211
similarArguments(fc, fc1)

0 commit comments

Comments
 (0)