Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f64743e

Browse files
committed
C++: Fix mistake in example for cpp/incorrect-allocation-error-handling.
1 parent 3ae4cb2 commit f64743e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cpp/ql/src/Security/CWE/CWE-570/IncorrectAllocationErrorHandling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void good1(std::size_t length) noexcept {
3434

3535
// GOOD: the allocation failure is handled appropriately.
3636
void good2(std::size_t length) noexcept {
37-
int* dest = new int[length];
37+
int* dest = new(std::nothrow) int[length];
3838
if(!dest) {
3939
return;
4040
}

0 commit comments

Comments
 (0)