mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	zwp_virtual-keyboard: fix mmap error handling
If mmap fails, it will return MAP_FAILED not NULL. Since the error handling was incorrectly checking for NULL, MAP_FAILED was being passed to xkb_keymap_new_from_string, on mmap failure, causing a segfault. This just fixes the error checking.
This commit is contained in:
		
							parent
							
								
									a5e32f652b
								
							
						
					
					
						commit
						6dfe238ff1
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -51,7 +51,7 @@ static void virtual_keyboard_keymap(struct wl_client *client,
 | 
			
		|||
		goto context_fail;
 | 
			
		||||
	}
 | 
			
		||||
	void *data = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
 | 
			
		||||
	if (!data) {
 | 
			
		||||
	if (data == MAP_FAILED) {
 | 
			
		||||
		goto fd_fail;
 | 
			
		||||
	}
 | 
			
		||||
	struct xkb_keymap *keymap = xkb_keymap_new_from_string(context, data,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue