From b45396c790277f3527425bf60c9f27718edf25c8 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Wed, 10 May 2023 16:02:07 -0400 Subject: wlr_drm_format: Introduce drm_format_finish --- render/drm_format_set.c | 7 +++++++ render/swapchain.c | 1 + 2 files changed, 8 insertions(+) (limited to 'render') diff --git a/render/drm_format_set.c b/render/drm_format_set.c index 8f3aea99..280d6465 100644 --- a/render/drm_format_set.c +++ b/render/drm_format_set.c @@ -8,8 +8,13 @@ #include #include "render/drm_format_set.h" +void wlr_drm_format_finish(struct wlr_drm_format *format) { + // For later +} + void wlr_drm_format_set_finish(struct wlr_drm_format_set *set) { for (size_t i = 0; i < set->len; ++i) { + wlr_drm_format_finish(set->formats[i]); free(set->formats[i]); } free(set->formats); @@ -60,6 +65,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format, return false; } if (!wlr_drm_format_add(&fmt, modifier)) { + wlr_drm_format_finish(fmt); return false; } @@ -196,6 +202,7 @@ struct wlr_drm_format *wlr_drm_format_intersect( // If the intersection is empty, then the formats aren't compatible with // each other. if (format->len == 0) { + wlr_drm_format_set_finish(format); free(format); return NULL; } diff --git a/render/swapchain.c b/render/swapchain.c index 5ccf812e..a15ac7f9 100644 --- a/render/swapchain.c +++ b/render/swapchain.c @@ -54,6 +54,7 @@ void wlr_swapchain_destroy(struct wlr_swapchain *swapchain) { slot_reset(&swapchain->slots[i]); } wl_list_remove(&swapchain->allocator_destroy.link); + wlr_drm_format_finish(swapchain->format); free(swapchain->format); free(swapchain); } -- cgit v1.2.3