Query module UnreleasedLock

name
Lock may not be released
description
A lock that is acquired one or more times without a matching number of unlocks may cause a deadlock.
kind
problem
id
cpp/unreleased-lock
problem.severity
error
precision
low
tags
security external/cwe/cwe-764 external/cwe/cwe-833

Imports

Synchronization

Utilities for analyzing synchronization primitives, such as mutexes and semaphores.

cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

blockIsLocked

Holds if there is a control flow path from src to b such that on that path the net number of locks is locks, and locks is positive.

failedLock

Holds if there is a call to lock or tryLock on t in lockblock, and failblock is the successor if it fails.

lockBlock
lockUnlockBlock

Holds if b locks t a net netlocks times. For example, if b locks t twice and unlocks t four times, then netlocks will be -2.

unlockBlock