From: Vadim Zeitlin Date: Sun, 2 Jan 2011 22:04:38 +0000 (+0000) Subject: Fix memory leak if wxDC::DrawBitmap() fails in wxOS2. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/13705b8ccf9159e94e0e9b954625906902efb284?ds=sidebyside Fix memory leak if wxDC::DrawBitmap() fails in wxOS2. Don't forget to free the buffer if we return abnormally. Closes #12825. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 228e231c5f..ab1b0ad718 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -1579,6 +1579,7 @@ void wxPMDCImpl::DoDrawBitmap( { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); + delete [] pucBits; return; } if ((lScans = ::GpiQueryBitmapBits( hPS @@ -1590,6 +1591,7 @@ void wxPMDCImpl::DoDrawBitmap( { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); + delete [] pucBits; return; } unsigned char cOldRedFore = (unsigned char)(lOldForeGround >> 16);