mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	wlr_drm_format_set_copy: Do not allocate heap
Address Sanitizer reported two memory leaks because of fmt not being freed in wlr_drm_format_set_copy. This commit fixes the memory leak by removing the allocation to the heap. The struct is allocated to the stack anyway.
This commit is contained in:
		
							parent
							
								
									10dd416694
								
							
						
					
					
						commit
						e449c1dec8
					
				
					 1 changed files with 0 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -153,12 +153,6 @@ bool wlr_drm_format_set_copy(struct wlr_drm_format_set *dst, const struct wlr_dr
 | 
			
		|||
 | 
			
		||||
	size_t i;
 | 
			
		||||
	for (i = 0; i < src->len; i++) {
 | 
			
		||||
		struct wlr_drm_format *fmt = calloc(1, sizeof(*fmt));
 | 
			
		||||
		if (!fmt) {
 | 
			
		||||
			wlr_drm_format_set_finish(&out);
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		out.formats[out.len] = (struct wlr_drm_format){0};
 | 
			
		||||
		if (!wlr_drm_format_copy(&out.formats[out.len], &src->formats[i])) {
 | 
			
		||||
			wlr_drm_format_set_finish(&out);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue