drm_format_set_union: Require initialized dst and remove assert

This commit is contained in:
Alexander Orzechowski 2023-05-04 14:16:34 -04:00 committed by Simon Ser
parent d7917d2076
commit 1ee75786b4
3 changed files with 4 additions and 7 deletions

View file

@ -258,8 +258,6 @@ static bool drm_format_set_extend(struct wlr_drm_format_set *dst,
bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
const struct wlr_drm_format_set *a, const struct wlr_drm_format_set *b) {
assert(dst != a && dst != b);
struct wlr_drm_format_set out = {0};
out.capacity = a->len + b->len;
out.formats = calloc(out.capacity, sizeof(struct wlr_drm_format *));
@ -276,6 +274,7 @@ bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
return false;
}
wlr_drm_format_set_finish(dst);
*dst = out;
return true;