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:
George Tasker
2001-12-02 22:54:38 +00:00
parent add33e95c5
commit 7527fdd873

View File

@@ -695,13 +695,14 @@ HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal) bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal)
{ {
HBITMAP hBitmap; HBITMAP hBitmap = NULL;
HPALETTE hPalette; HPALETTE hPalette = NULL;
bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0); bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0);
if (!success) if (!success)
{ {
if (hPalette)
DeleteObject(hPalette); DeleteObject(hPalette);
return FALSE; return FALSE;
} }