Fix Miscellaneous Regressions and UBs (#1022)

This commit is contained in:
Headline
2019-05-28 18:04:08 -07:00
committed by GitHub
parent 2164f5191e
commit 28036966a6
6 changed files with 39 additions and 72 deletions
+9 -3
View File
@@ -227,11 +227,17 @@ private:
/* finally, allocate the new block */
if (m_Data)
{
m_Data = (cell_t *)realloc(m_Data, sizeof(cell_t) * m_BlockSize * m_AllocSize);
cell_t *data = static_cast<cell_t*>(realloc(m_Data, sizeof(cell_t) * m_BlockSize * m_AllocSize));
if (!data) // allocation failure
{
return false;
}
m_Data = data;
} else {
m_Data = (cell_t *)malloc(sizeof(cell_t) * m_BlockSize * m_AllocSize);
m_Data = static_cast<cell_t*>(malloc(sizeof(cell_t) * m_BlockSize * m_AllocSize));
}
return (m_Data != NULL);
return (m_Data != nullptr);
}
private:
cell_t *m_Data;