aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2024-02-22 23:03:50 +0100
committerKenny Levinsen <kl@kl.wtf>2024-02-22 23:03:50 +0100
commit73dd9347949378fca13f5a6cfb351cfef7c8d2a7 (patch)
tree4f5b02ffd1999f5db98802ddc775791a888d06d2
parent484a87ce616e28791e9f7ae285d79e1ec4871892 (diff)
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.
-rw-r--r--render/drm_format_set.c7
1 files changed, 3 insertions, 4 deletions
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;
}