Skip to content

Commit f866e16

Browse files
committed
Use any instead of exists for isCloseSink
1 parent 5ab6056 commit f866e16

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,12 @@ predicate isWritableFileHandle(DataFlow::Node source, DataFlow::CallNode call) {
9090
* Determines whether `os.File.Close` is called on `sink`.
9191
*/
9292
predicate isCloseSink(DataFlow::Node sink, DataFlow::CallNode call) {
93-
exists(CloseFileFun f |
94-
// find calls to the os.File.Close function
95-
f.getACall() = call and
96-
// that are deferred
97-
unhandledCall(call) and
98-
// where the function is called on the sink
99-
call.getReceiver() = sink
100-
)
93+
// find calls to the os.File.Close function
94+
call = any(CloseFileFun f).getACall() and
95+
// that are deferred
96+
unhandledCall(call) and
97+
// where the function is called on the sink
98+
call.getReceiver() = sink
10199
}
102100

103101
/**

0 commit comments

Comments
 (0)