diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-11-27 02:17:49 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-11-27 02:17:49 +0000 |
commit | 67cdb57fbdd69b8f49bfb86cd8d2ac238fbaf565 (patch) | |
tree | b13173763f63d6d966e2af6d114cba79e438d27e /lib/libdrm/xf86drmMode.c | |
parent | 418716549a51f9c9cfe5d6852fe61d8b695f00b3 (diff) |
Merge libdrm 2.4.100
Diffstat (limited to 'lib/libdrm/xf86drmMode.c')
-rw-r--r-- | lib/libdrm/xf86drmMode.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c index 8f8633ed3..207d7be91 100644 --- a/lib/libdrm/xf86drmMode.c +++ b/lib/libdrm/xf86drmMode.c @@ -650,7 +650,7 @@ drm_public drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id) } if (!(r = drmMalloc(sizeof(*r)))) - return NULL; + goto err_allocs; r->prop_id = prop.prop_id; r->count_values = prop.count_values; @@ -1259,7 +1259,7 @@ drm_public drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) return NULL; } memcpy(new->items, old->items, - old->size_items * sizeof(*new->items)); + old->cursor * sizeof(*new->items)); } else { new->items = NULL; } @@ -1322,12 +1322,13 @@ drm_public int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, return -EINVAL; if (req->cursor >= req->size_items) { + const uint32_t item_size_inc = getpagesize() / sizeof(*req->items); drmModeAtomicReqItemPtr new; - req->size_items += 16; + req->size_items += item_size_inc; new = realloc(req->items, req->size_items * sizeof(*req->items)); if (!new) { - req->size_items -= 16; + req->size_items -= item_size_inc; return -ENOMEM; } req->items = new; |