X11: use SDL_malloc

This commit is contained in:
Sylvain 2021-11-22 16:37:34 +01:00 committed by Sam Lantinga
parent 19bf36db15
commit 9fcc630fb3

View file

@ -35,7 +35,7 @@ X11_CreateShaper(SDL_Window* window) {
#if SDL_VIDEO_DRIVER_X11_XSHAPE
if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
result = malloc(sizeof(SDL_WindowShaper));
result = SDL_malloc(sizeof(SDL_WindowShaper));
result->window = window;
result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1;
@ -65,8 +65,8 @@ X11_ResizeWindowShape(SDL_Window* window) {
if(data->bitmapsize != bitmapsize || data->bitmap == NULL) {
data->bitmapsize = bitmapsize;
if(data->bitmap != NULL)
free(data->bitmap);
data->bitmap = malloc(data->bitmapsize);
SDL_free(data->bitmap);
data->bitmap = SDL_malloc(data->bitmapsize);
if(data->bitmap == NULL) {
return SDL_SetError("Could not allocate memory for shaped-window bitmap.");
}