CodeQL library for C/C++
codeql/cpp-all 0.12.7-dev (changelog, source)
Search

Module Alloc

Import path

import semmle.code.cpp.commons.Alloc

Imports

Allocation

Provides an abstract class for modeling functions and expressions that allocate memory, such as the standard malloc function. To use this QL library, create one or more QL classes extending a class here with a characteristic predicate that selects the functions or expressions you are trying to model. Within that class, override the predicates provided by the abstract class to match the specifics of those functions or expressions. Finally, add a private import statement to Models.qll.

Deallocation

Provides an abstract class for modeling functions and expressions that deallocate memory, such as the standard free function. To use this QL library, create one or more QL classes extending a class here with a characteristic predicate that selects the functions or expressions you are trying to model. Within that class, override the predicates provided by the abstract class to match the specifics of those functions or expressions. Finally, add a private import statement to Models.qll.

cpp

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

Predicates

freeCall

A call to a library routine that frees memory.

freeFunction

A library routine that frees memory.

isAllocationExpr

Is e some kind of allocation (new, alloc, realloc etc)?

isMemoryManagementExpr

Is e some kind of allocation or deallocation (new, alloc, realloc, delete, free etc)?