@@ -210,6 +210,12 @@ static HCURSOR WIN_CreateHCursor(SDL_Surface *surface, int hot_x, int hot_y)
if (!ii.hbmMask || (!is_monochrome && !ii.hbmColor)) {
SDL_SetError("Couldn't create cursor bitmaps");
+ if (ii.hbmMask) {
+ DeleteObject(ii.hbmMask);
+ }
+ if (ii.hbmColor) {
+ DeleteObject(ii.hbmColor);
return NULL;
}