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
This commit is contained in:
Vadim Zeitlin
2011-01-02 22:04:38 +00:00
parent b622441a8d
commit 13705b8ccf

View File

@@ -1579,6 +1579,7 @@ void wxPMDCImpl::DoDrawBitmap(
{ {
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
delete [] pucBits;
return; return;
} }
if ((lScans = ::GpiQueryBitmapBits( hPS if ((lScans = ::GpiQueryBitmapBits( hPS
@@ -1590,6 +1591,7 @@ void wxPMDCImpl::DoDrawBitmap(
{ {
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
delete [] pucBits;
return; return;
} }
unsigned char cOldRedFore = (unsigned char)(lOldForeGround >> 16); unsigned char cOldRedFore = (unsigned char)(lOldForeGround >> 16);