Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you overload operator new in global scope, you should also overload operator delete in global scope. Likewise, overloading operator new in the scope of a class mandates the overloading of operator delete in the same class. Failure to overload operator delete will cause the global delete to be called to release a resource that was allocated with an overloaded operator new. Violation of this rule is likely to also violate MEM39-CPP. Object and array delete must be properly paired with the corresponding newResources allocated by memory allocation functions must be released using the corresponding memory deallocation function

Risk Assessment

Mismatched usage of new and delete could lead to a denial-of-service attack.

...