mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	render/vulkan: Avoid double-free on calloc error
In query_modifier_support, the calloc for either or both of render_mods and texture_mods may fail, in which case both are freed for convenience. However, if one is non-NULL, vulkan_format_props_finish will try to free it again. NULL them to avoid double-free.
This commit is contained in:
		
							parent
							
								
									73dd934794
								
							
						
					
					
						commit
						4d68d3759b
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -401,6 +401,8 @@ static bool query_modifier_support(struct wlr_vk_device *dev,
 | 
				
			||||||
		free(modp.pDrmFormatModifierProperties);
 | 
							free(modp.pDrmFormatModifierProperties);
 | 
				
			||||||
		free(props->dmabuf.render_mods);
 | 
							free(props->dmabuf.render_mods);
 | 
				
			||||||
		free(props->dmabuf.texture_mods);
 | 
							free(props->dmabuf.texture_mods);
 | 
				
			||||||
 | 
							props->dmabuf.render_mods = NULL;
 | 
				
			||||||
 | 
							props->dmabuf.texture_mods = NULL;
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue