npPal = (LPLOGPALETTE)malloc(sizeof(LOGPALETTE) +
(WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY));
if (!npPal)
- return(FALSE);
+ return NULL;
npPal->palVersion = 0x300;
npPal->palNumEntries = (WORD)lpInfo->biClrUsed;
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;
}