From dd69d7b7640fd4f957cee27eb274152cf8311f0c Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Fri, 9 Feb 2018 19:37:01 +0100 Subject: [PATCH] Use VLA instead of heap alloc --- backend/drm/atomic.c | 5 +---- 1 file changed, 1 insertion(+), 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);