mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[REGEXPL]
Fix memory leaks Fix broken if condition Use delete[] operator for allocations made with new[] operator Properly check for failed allocations by not throwing exception svn path=/trunk/; revision=54034
This commit is contained in:
parent
7e02fbd0dd
commit
c91f9ef382
16 changed files with 100 additions and 82 deletions
|
@ -39,7 +39,7 @@ CTextHistory::CTextHistory()
|
|||
|
||||
CTextHistory::~CTextHistory()
|
||||
{
|
||||
if (m_pHistoryBuffer) delete m_pHistoryBuffer;
|
||||
if (m_pHistoryBuffer) delete[] m_pHistoryBuffer;
|
||||
}
|
||||
|
||||
BOOL CTextHistory::Init(DWORD dwMaxHistoryLineSize, DWORD dwMaxHistoryLines)
|
||||
|
@ -49,13 +49,13 @@ BOOL CTextHistory::Init(DWORD dwMaxHistoryLineSize, DWORD dwMaxHistoryLines)
|
|||
ASSERT(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
if (m_pHistoryBuffer) delete m_pHistoryBuffer;
|
||||
if (m_pHistoryBuffer) delete[] m_pHistoryBuffer;
|
||||
m_dwFirstHistoryIndex = 0;
|
||||
m_dwLastHistoryIndex = 0;
|
||||
m_dwHisoryFull = 0;
|
||||
m_dwMaxHistoryLines = dwMaxHistoryLines;
|
||||
m_dwMaxHistoryLineSize = dwMaxHistoryLineSize;
|
||||
m_pHistoryBuffer = new TCHAR [m_dwMaxHistoryLines*dwMaxHistoryLineSize];
|
||||
m_pHistoryBuffer = new (std::nothrow) TCHAR [m_dwMaxHistoryLines*dwMaxHistoryLineSize];
|
||||
if (!m_pHistoryBuffer) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue