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:
Markus Mäkelä 2020-07-03 05:47:44 +03:00
parent ba289dc589
commit ad4bd26ff0
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -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))
{