aboutsummaryrefslogtreecommitdiff
path: root/render/drm_format_set.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-12-08 16:02:44 +0100
committerSimon Ser <contact@emersion.fr>2020-12-08 16:02:44 +0100
commit29da97c185c60eae5d9eaf743c3895c4dba139f7 (patch)
treec71c20dfd17ae9119fc289bfc5423895422f9225 /render/drm_format_set.c
parente69bbfd0d6a654a0421793bf10cb3cab15e13273 (diff)
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).
Diffstat (limited to 'render/drm_format_set.c')
-rw-r--r--render/drm_format_set.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/render/drm_format_set.c b/render/drm_format_set.c
index d6be706d..b3e8648e 100644
--- a/render/drm_format_set.c
+++ b/render/drm_format_set.c
@@ -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;