Skip to content
Permalink
Browse files

mir: Fixed memory leak if system cursor id is unknown.

  • Loading branch information
philippwiesemann committed May 6, 2017
1 parent 34d9c52 commit 34747107fe38baac55f1972f4fb1c051510b812e
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/video/mir/SDL_mirmouse.c
@@ -139,15 +139,9 @@ static SDL_Cursor*
MIR_CreateSystemCursor(SDL_SystemCursor id)
{
char const* cursor_name = NULL;
SDL_Cursor* cursor = MIR_CreateDefaultCursor();
SDL_Cursor* cursor;
MIR_Cursor* mir_cursor;

if (!cursor) {
return NULL;
}

mir_cursor = (MIR_Cursor*)cursor->driverdata;

switch(id) {
case SDL_SYSTEM_CURSOR_ARROW:
cursor_name = MIR_mir_arrow_cursor_name;
@@ -192,6 +186,12 @@ MIR_CreateSystemCursor(SDL_SystemCursor id)
return NULL;
}

cursor = MIR_CreateDefaultCursor();
if (!cursor) {
return NULL;
}

mir_cursor = (MIR_Cursor*)cursor->driverdata;
mir_cursor->name = cursor_name;

return cursor;

0 comments on commit 3474710

Please sign in to comment.