mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: avoid potential deadlock when resizing from zero-sized list
- not yet triggered by any code, but avoid anyhow
This commit is contained in:
@ -163,6 +163,8 @@ inline T& Foam::List<T>::newElmt(const label i)
|
||||
|
||||
if (i >= n)
|
||||
{
|
||||
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
|
||||
|
||||
do
|
||||
{
|
||||
n *= 2;
|
||||
|
||||
@ -114,8 +114,10 @@ void Foam::ITstream::reserveCapacity
|
||||
|
||||
label n = tokenList::size();
|
||||
|
||||
if (nElem >= n)
|
||||
if (nElem > n)
|
||||
{
|
||||
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
|
||||
|
||||
do
|
||||
{
|
||||
n *= 2;
|
||||
|
||||
Reference in New Issue
Block a user