aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-17 23:13:05 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-06-19 00:19:50 -0400
commit64c0272f818523537fe8e133d97539e50fdfec64 (patch)
tree4b91abd9b5d410faa15ab0e0a46cc7e46b5296a4
parent3ee0f52e09d422b497434f724b9c2e1606c02bea (diff)
output_state: Gamma lut should be freed only if committed
We consider state that is not committed to be uninitialized.
-rw-r--r--types/output/state.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/types/output/state.c b/types/output/state.c
index 9c96fc8e..4633966c 100644
--- a/types/output/state.c
+++ b/types/output/state.c
@@ -112,7 +112,9 @@ bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
memcpy(gamma_lut + ramp_size, g, ramp_size * sizeof(uint16_t));
memcpy(gamma_lut + 2 * ramp_size, b, ramp_size * sizeof(uint16_t));
} else {
- free(state->gamma_lut);
+ if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) {
+ free(state->gamma_lut);
+ }
}
state->committed |= WLR_OUTPUT_STATE_GAMMA_LUT;