Skip to content

Commit

Permalink
Raspberry: Fixed crash if memory allocation for cursor failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Mar 3, 2016
1 parent 21d3297 commit 05b6ca3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/video/raspberry/SDL_rpimouse.c
Expand Up @@ -70,7 +70,16 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
SDL_assert(surface->pitch == surface->w * 4);

cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
if (cursor == NULL) {
SDL_OutOfMemory();
return NULL;
}
curdata = (RPI_CursorData *) SDL_calloc(1, sizeof(*curdata));
if (curdata == NULL) {
SDL_OutOfMemory();
SDL_free(cursor);
return NULL;
}

curdata->hot_x = hot_x;
curdata->hot_y = hot_y;
Expand Down

0 comments on commit 05b6ca3

Please sign in to comment.