mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	wlr_output_state: Consider gamma_lut uninitialized if not committed
This commit is contained in:
		
							parent
							
								
									b80e67d6e6
								
							
						
					
					
						commit
						a09bb1314d
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -14,8 +14,10 @@ void wlr_output_state_finish(struct wlr_output_state *state) {
 | 
				
			||||||
	if (state->committed & WLR_OUTPUT_STATE_DAMAGE) {
 | 
						if (state->committed & WLR_OUTPUT_STATE_DAMAGE) {
 | 
				
			||||||
		pixman_region32_fini(&state->damage);
 | 
							pixman_region32_fini(&state->damage);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
 | 
				
			||||||
		free(state->gamma_lut);
 | 
							free(state->gamma_lut);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_output_state_set_enabled(struct wlr_output_state *state,
 | 
					void wlr_output_state_set_enabled(struct wlr_output_state *state,
 | 
				
			||||||
		bool enabled) {
 | 
							bool enabled) {
 | 
				
			||||||
| 
						 | 
					@ -97,7 +99,11 @@ bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
 | 
				
			||||||
		size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b) {
 | 
							size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b) {
 | 
				
			||||||
	uint16_t *gamma_lut = NULL;
 | 
						uint16_t *gamma_lut = NULL;
 | 
				
			||||||
	if (ramp_size > 0) {
 | 
						if (ramp_size > 0) {
 | 
				
			||||||
 | 
							if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
 | 
				
			||||||
			gamma_lut = realloc(state->gamma_lut, 3 * ramp_size * sizeof(uint16_t));
 | 
								gamma_lut = realloc(state->gamma_lut, 3 * ramp_size * sizeof(uint16_t));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								gamma_lut = malloc(3 * ramp_size * sizeof(uint16_t));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if (gamma_lut == NULL) {
 | 
							if (gamma_lut == NULL) {
 | 
				
			||||||
			wlr_log_errno(WLR_ERROR, "Allocation failed");
 | 
								wlr_log_errno(WLR_ERROR, "Allocation failed");
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue