From 73dd9347949378fca13f5a6cfb351cfef7c8d2a7 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Thu, 22 Feb 2024 23:03:50 +0100 Subject: render/drm_format_set: Clean up on union failure If drm_format_set_extend fails, we need to make sure each wlr_drm_format is cleaned up together with the formats array. Finish the set to take care of it. --- render/drm_format_set.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'render') diff --git a/render/drm_format_set.c b/render/drm_format_set.c index e24152f6..dc57ad9b 100644 --- a/render/drm_format_set.c +++ b/render/drm_format_set.c @@ -271,10 +271,9 @@ bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst, } // Add both a and b sets into out - if (!drm_format_set_extend(&out, a)) { - return false; - } - if (!drm_format_set_extend(&out, b)) { + if (!drm_format_set_extend(&out, a) || + !drm_format_set_extend(&out, b)) { + wlr_drm_format_set_finish(&out); return false; } -- cgit v1.2.3