mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 23:55:07 +00:00
[ATL] Do not corrupt the internal state of the CSimpleArray when allocation fails. Patch by Katayama Hirofumi MZ. CORE-11946 #comment Committed, thanks!
svn path=/trunk/; revision=72705
This commit is contained in:
parent
ea13a8e917
commit
d1a6ea86f7
|
@ -182,16 +182,17 @@ public:
|
||||||
{
|
{
|
||||||
RemoveAll();
|
RemoveAll();
|
||||||
|
|
||||||
m_nCapacity = src.GetSize();
|
int nNewCount = src.GetSize();
|
||||||
|
|
||||||
T *pNewData = (T *)realloc(m_pData, m_nCapacity * sizeof(T));
|
T *pNewData = (T *)realloc(m_pData, nNewCount * sizeof(T));
|
||||||
ATLASSERT(pNewData);
|
ATLASSERT(pNewData);
|
||||||
if (pNewData == NULL)
|
if (pNewData == NULL)
|
||||||
return *this; // failure
|
return *this; // failure
|
||||||
|
|
||||||
// store new data and capacity
|
// store new
|
||||||
m_pData = pNewData;
|
m_pData = pNewData;
|
||||||
m_nCount = m_nCapacity;
|
m_nCount = nNewCount;
|
||||||
|
m_nCapacity = nNewCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue