mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Respond to review comments.
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<overview>
|
||||
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways:
|
||||
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways.
|
||||
If <code>new T</code> fails for some type <code>T</code>, it throws a <code>std::bad_alloc</code> exception,
|
||||
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer handles the wrong kind of
|
||||
failure, it could cause the program to behave in unexpected ways.</p>
|
||||
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer does not use the corresponding
|
||||
method of error handling, allocation failure may go unhandled and could cause the program to behave in
|
||||
unexpected ways.</p>
|
||||
|
||||
</overview>
|
||||
<recommendation>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @name Detect And Handle Memory Allocation Errors
|
||||
* @description `operator new` throws an exception on allocation failures, while `operator new(std::nothrow)` returns a null pointer.
|
||||
* Mixing up these two failure conditions can result in unexpected behavior.
|
||||
* @description `operator new` throws an exception on allocation failures, while `operator new(std::nothrow)` returns a null pointer. Mixing up these two failure conditions can result in unexpected behavior.
|
||||
* @kind problem
|
||||
* @id cpp/detect-and-handle-memory-allocation-errors
|
||||
* @problem.severity warning
|
||||
|
||||
Reference in New Issue
Block a user