C++: Fix mistake in example for cpp/incorrect-allocation-error-handling.

This commit is contained in:
Geoffrey White
2024-07-04 16:19:32 +01:00
parent 3ae4cb2f9d
commit f64743e91d

View File

@@ -34,7 +34,7 @@ void good1(std::size_t length) noexcept {
// GOOD: the allocation failure is handled appropriately.
void good2(std::size_t length) noexcept {
int* dest = new int[length];
int* dest = new(std::nothrow) int[length];
if(!dest) {
return;
}