CodeQL library for C/C++
Search

Module 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.

Import path

import semmle.code.cpp.models.interfaces.Allocation

Imports

Function

Provides classes for working with functions, including template functions.

Models

Classes

AllocationExpr

An allocation expression such as call to malloc or a new expression.

AllocationFunction

An allocation function such as malloc.

OperatorNewAllocationFunction

An operator new or operator new[] function that may be associated with new or new[] expressions. Note that new and new[] are not function calls, but these functions may also be called directly.