aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2018-02-09 19:37:01 +0100
committerVincent Vanlaer <vincent.vanlaer@skynet.be>2018-02-09 19:37:01 +0100
commitdd69d7b7640fd4f957cee27eb274152cf8311f0c (patch)
tree73b46ea00d55421a63ae72ebdf52957bf5590f5a /backend/drm
parent0232269a2d92e76dfe20cfbde0646798ab080e95 (diff)
Use VLA instead of heap alloc
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/atomic.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 10714e35..166d60a0 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -199,7 +199,7 @@ static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
uint32_t size) {
- struct drm_color_lut *gamma = calloc(sizeof(struct drm_color_lut), size);
+ struct drm_color_lut gamma[size];
for (uint32_t i = 0; i < size; i++) {
gamma[i].red = r[i];
@@ -214,12 +214,9 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
if (drmModeCreatePropertyBlob(drm->fd, gamma,
sizeof(struct drm_color_lut) * size, &crtc->gamma_lut)) {
wlr_log_errno(L_ERROR, "Unable to create property blob");
- free(gamma);
return false;
}
- free(gamma);
-
struct atomic atom;
atomic_begin(crtc, &atom);
atomic_add(&atom, crtc->id, crtc->props.gamma_lut, crtc->gamma_lut);