Fixed incorrect deletion of hPalette if the call to wxReadDIB() fails
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12833 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
add33e95c5
commit
7527fdd873
@ -695,14 +695,15 @@ HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
|
||||
|
||||
bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
HPALETTE hPalette;
|
||||
HBITMAP hBitmap = NULL;
|
||||
HPALETTE hPalette = NULL;
|
||||
|
||||
bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
DeleteObject(hPalette);
|
||||
if (hPalette)
|
||||
DeleteObject(hPalette);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user