mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
render/drm_format_set: allocate using cap when duplicating
In wlr_drm_format_dup, allocate the new wlr_drm_format using cap instead of len. This makes it so the cap field is up-to-date and the chunk of memory isn't too small if we append new modifiers (we don't allow this yet but might in the future).
This commit is contained in:
parent
e69bbfd0d6
commit
29da97c185
1 changed files with 1 additions and 1 deletions
|
@ -129,7 +129,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
|
|||
|
||||
struct wlr_drm_format *wlr_drm_format_dup(const struct wlr_drm_format *format) {
|
||||
size_t format_size = sizeof(struct wlr_drm_format) +
|
||||
format->len * sizeof(format->modifiers[0]);
|
||||
format->cap * sizeof(format->modifiers[0]);
|
||||
struct wlr_drm_format *duped_format = malloc(format_size);
|
||||
if (duped_format == NULL) {
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue