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. Resources 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.
Rule |
Severity |
Likelihood |
Remediation Cost |
Priority |
Level |
---|---|---|---|---|---|
DCL35-CPP |
1 (low) |
1 (unlikely) |
3 (low) |
P3 |
L3 |
References
TODO