MXS-2585: Check for failed allocations
Since nothrow was used, the return value should be checked. By moving the null-check after the node allocation part, we'll detect it.
This commit is contained in:
parent
ba289dc589
commit
ad4bd26ff0
9
server/modules/filter/cache/lrustorage.cc
vendored
9
server/modules/filter/cache/lrustorage.cc
vendored
@ -551,11 +551,6 @@ cache_result_t LRUStorage::get_new_node(const CACHE_KEY& key,
|
||||
mxb_assert(m_stats.items == m_max_count);
|
||||
pNode = vacate_lru();
|
||||
}
|
||||
|
||||
if (!pNode)
|
||||
{
|
||||
result = CACHE_RESULT_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -578,6 +573,10 @@ cache_result_t LRUStorage::get_new_node(const CACHE_KEY& key,
|
||||
result = CACHE_RESULT_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = CACHE_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if (CACHE_RESULT_IS_OK(result))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user