From 13705b8ccf9159e94e0e9b954625906902efb284 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Jan 2011 22:04:38 +0000 Subject: [PATCH] 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 --- src/os2/dc.cpp | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.45.2