mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Fix output destory: impl->destroy must be called last + obvious double-free
This commit is contained in:
		
							parent
							
								
									9a9dd15d5f
								
							
						
					
					
						commit
						db77530a35
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -178,13 +178,16 @@ void wlr_output_destroy(struct wlr_output *output) {
 | 
				
			||||||
	wlr_texture_destroy(output->cursor.texture);
 | 
						wlr_texture_destroy(output->cursor.texture);
 | 
				
			||||||
	wlr_renderer_destroy(output->cursor.renderer);
 | 
						wlr_renderer_destroy(output->cursor.renderer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->impl->destroy(output);
 | 
					 | 
				
			||||||
	for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
 | 
						for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
 | 
				
			||||||
		struct wlr_output_mode *mode = output->modes->items[i];
 | 
							struct wlr_output_mode *mode = output->modes->items[i];
 | 
				
			||||||
		free(mode);
 | 
							free(mode);
 | 
				
			||||||
		free(mode);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	list_free(output->modes);
 | 
						list_free(output->modes);
 | 
				
			||||||
 | 
						if (output->impl->destroy) {
 | 
				
			||||||
 | 
							output->impl->destroy(output);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							free(output);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_output_effective_resolution(struct wlr_output *output,
 | 
					void wlr_output_effective_resolution(struct wlr_output *output,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue