Query module UnreleasedLock

name
Unreleased lock
description
A lock that is acquired one or more times without a matching number of unlocks may cause a deadlock.
kind
problem
problem.severity
error
precision
medium
id
java/unreleased-lock
tags
reliability security external/cwe/cwe-764 external/cwe/cwe-833

Imports

Guards
Mockito

Provides classes and predicates for identifying use of the Mockito mocking framework.

SSA

Provides classes and predicates for SSA representation (Static Single Assignment form).

java

Provides all default Java QL imports.

Predicates

blockIsLocked

A control flow path from a locking call in src to b such that the number of locks minus the number of unlocks along the way is positive and equal to locks.

failedLock

A call to lock or tryLock on t that fails with an exception or the value false resulting in a CFG edge from lockblock to exblock.

heldByCurrentThreadCheck

A call to isHeldByCurrentThread on t in checkblock that has falsesucc as the false successor.

lockBlock
lockUnlockBlock

A block b that locks and/or unlocks t a number of times; netlocks equals the number of locks minus the number of unlocks.

unlockBlock

Classes