CERT.MEM.OVERRIDE.DELETE

Honor replacement dynamic storage management requirements for 'delete'.

Vulnerability and risk

Dynamic memory allocation and deallocation functions can be globally replaced by custom implementations.

A replacement for any of the dynamic memory allocation or deallocation functions must meet the semantic requirements specified by the appropriate required behavior clause of the replaced function.

This checker looks for replacement functions for "delete" and checks that they are defined with noexcept.

Mitigation and prevention

Replacement "delete" functions should be defined with noexcept.

Example

Copy
  void operator delete(void *ptr) {};
  void operator delete[](void *ptr) {};

Violations will be reported on lines 1 and 2.