fix heap corruption bug: use delete[] to delete a buffer allocated with new[], not delete
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,8 +61,8 @@ wxConnectionBase::wxConnectionBase(const wxConnectionBase& copy)
|
|||||||
|
|
||||||
wxConnectionBase::~wxConnectionBase(void)
|
wxConnectionBase::~wxConnectionBase(void)
|
||||||
{
|
{
|
||||||
if ( m_deletebufferwhendone && m_buffer )
|
if ( m_deletebufferwhendone )
|
||||||
delete m_buffer;
|
delete [] m_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
|
wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
|
||||||
@@ -73,8 +73,7 @@ wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
|
|||||||
{ // need to resize buffer
|
{ // need to resize buffer
|
||||||
if ( m_deletebufferwhendone )
|
if ( m_deletebufferwhendone )
|
||||||
{ // we're in charge of buffer, increase it
|
{ // we're in charge of buffer, increase it
|
||||||
if ( m_buffer )
|
delete [] m_buffer;
|
||||||
delete m_buffer;
|
|
||||||
// the argument specifies **byte size**, but m_buffer is of type
|
// the argument specifies **byte size**, but m_buffer is of type
|
||||||
// wxChar. Under unicode: sizeof(wxChar) > 1, so the buffer size is
|
// wxChar. Under unicode: sizeof(wxChar) > 1, so the buffer size is
|
||||||
// bytes / sizeof(wxChar) rounded upwards.
|
// bytes / sizeof(wxChar) rounded upwards.
|
||||||
|
Reference in New Issue
Block a user