mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 14:45:00 +00:00 
			
		
		
		
	mir: Fixed memory leak if system cursor id is unknown.
This commit is contained in:
		
							parent
							
								
									34d9c5213c
								
							
						
					
					
						commit
						34747107fe
					
				| 
						 | 
					@ -139,15 +139,9 @@ static SDL_Cursor*
 | 
				
			||||||
MIR_CreateSystemCursor(SDL_SystemCursor id)
 | 
					MIR_CreateSystemCursor(SDL_SystemCursor id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char const* cursor_name = NULL;
 | 
					    char const* cursor_name = NULL;
 | 
				
			||||||
    SDL_Cursor* cursor      = MIR_CreateDefaultCursor();
 | 
					    SDL_Cursor* cursor;
 | 
				
			||||||
    MIR_Cursor* mir_cursor;
 | 
					    MIR_Cursor* mir_cursor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!cursor) {
 | 
					 | 
				
			||||||
        return NULL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mir_cursor = (MIR_Cursor*)cursor->driverdata;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch(id) {
 | 
					    switch(id) {
 | 
				
			||||||
        case SDL_SYSTEM_CURSOR_ARROW:
 | 
					        case SDL_SYSTEM_CURSOR_ARROW:
 | 
				
			||||||
            cursor_name = MIR_mir_arrow_cursor_name;
 | 
					            cursor_name = MIR_mir_arrow_cursor_name;
 | 
				
			||||||
| 
						 | 
					@ -192,6 +186,12 @@ MIR_CreateSystemCursor(SDL_SystemCursor id)
 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cursor = MIR_CreateDefaultCursor();
 | 
				
			||||||
 | 
					    if (!cursor) {
 | 
				
			||||||
 | 
					        return NULL;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mir_cursor = (MIR_Cursor*)cursor->driverdata;
 | 
				
			||||||
    mir_cursor->name = cursor_name;
 | 
					    mir_cursor->name = cursor_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return cursor;
 | 
					    return cursor;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue