diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 52e1cce2a..1d021b7b6 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -129,8 +129,14 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y) unsigned int width_bytes = ((surface->w + 7) & ~7) / 8; data_bits = SDL_calloc(1, surface->h * width_bytes); + if (!data_bits) { + SDL_OutOfMemory(); + return None; + } + mask_bits = SDL_calloc(1, surface->h * width_bytes); - if (!data_bits || !mask_bits) { + if (!mask_bits) { + SDL_free(data_bits); SDL_OutOfMemory(); return None; }