mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	render/drm_format_set: allocate using cap when duplicating
In wlr_drm_format_dup, allocate the new wlr_drm_format using cap instead of len. This makes it so the cap field is up-to-date and the chunk of memory isn't too small if we append new modifiers (we don't allow this yet but might in the future).
This commit is contained in:
		
							parent
							
								
									e69bbfd0d6
								
							
						
					
					
						commit
						29da97c185
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -129,7 +129,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
 | 
			
		|||
 | 
			
		||||
struct wlr_drm_format *wlr_drm_format_dup(const struct wlr_drm_format *format) {
 | 
			
		||||
	size_t format_size = sizeof(struct wlr_drm_format) +
 | 
			
		||||
		format->len * sizeof(format->modifiers[0]);
 | 
			
		||||
		format->cap * sizeof(format->modifiers[0]);
 | 
			
		||||
	struct wlr_drm_format *duped_format = malloc(format_size);
 | 
			
		||||
	if (duped_format == NULL) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue