mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	keyboard: Fix use-after-free in keyboard_finish()
This commit is contained in:
		
							parent
							
								
									bbc6c6bb94
								
							
						
					
					
						commit
						086a887058
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -241,8 +241,15 @@ void
 | 
				
			||||||
keyboard_finish(struct seat *seat)
 | 
					keyboard_finish(struct seat *seat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (seat->keyboard_group) {
 | 
						if (seat->keyboard_group) {
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Caution - these event listeners are connected to
 | 
				
			||||||
 | 
							 * seat->keyboard_group->keyboard and must be
 | 
				
			||||||
 | 
							 * unregistered before wlr_keyboard_group_destroy(),
 | 
				
			||||||
 | 
							 * otherwise a use-after-free occurs.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							wl_list_remove(&seat->keyboard_key.link);
 | 
				
			||||||
 | 
							wl_list_remove(&seat->keyboard_modifiers.link);
 | 
				
			||||||
		wlr_keyboard_group_destroy(seat->keyboard_group);
 | 
							wlr_keyboard_group_destroy(seat->keyboard_group);
 | 
				
			||||||
 | 
							seat->keyboard_group = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wl_list_remove(&seat->keyboard_key.link);
 | 
					 | 
				
			||||||
	wl_list_remove(&seat->keyboard_modifiers.link);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue