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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user