From: Vadim Zeitlin Date: Mon, 14 Jul 2008 02:34:29 +0000 (+0000) Subject: fix heap corruption bug: use delete[] to delete a buffer allocated with new[], not... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4563378999820f27a37155e99b0bc03b2536657f?hp=e7ce668e1db4471bf59049571be288233b1322f3 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/trunk@54615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/ipcbase.cpp b/src/common/ipcbase.cpp index ee7e34278f..d96b9374a9 100644 --- a/src/common/ipcbase.cpp +++ b/src/common/ipcbase.cpp @@ -62,7 +62,7 @@ wxConnectionBase::wxConnectionBase(const wxConnectionBase& copy) wxConnectionBase::~wxConnectionBase() { if ( m_deletebufferwhendone ) - delete m_buffer; + delete [] m_buffer; } /* static */ @@ -120,8 +120,7 @@ void *wxConnectionBase::GetBufferAtLeast( size_t bytes ) { // need to resize buffer if ( m_deletebufferwhendone ) { // we're in charge of buffer, increase it - if ( m_buffer ) - delete m_buffer; + delete [] m_buffer; m_buffer = new char[bytes]; m_buffersize = bytes; return m_buffer;