aboutsummaryrefslogtreecommitdiff
path: root/render/drm_format_set.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-08-12 19:53:39 +0900
committerDrew DeVault <sir@cmpwn.com>2019-08-12 19:53:39 +0900
commit540e23d1029acf621c8da992aa56a4d7f98abe3a (patch)
tree7f47e912b1c80a5c7c122558d2c568ac5043a9cd /render/drm_format_set.c
parent82f48b8912515cb2c6dc1b10dfa783fa50a0422c (diff)
Revert "render/drm: keep old drm_format if realloc fails"
This reverts commit c1be9b6945f9c664fe694a09620758db9ca695e9.
Diffstat (limited to 'render/drm_format_set.c')
-rw-r--r--render/drm_format_set.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/render/drm_format_set.c b/render/drm_format_set.c
index 297c2ab1..b09a68a4 100644
--- a/render/drm_format_set.c
+++ b/render/drm_format_set.c
@@ -60,7 +60,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
struct wlr_drm_format **ptr = format_set_get_ref(set, format);
if (ptr) {
- struct wlr_drm_format *fmt = *ptr, *newfmt = NULL;
+ struct wlr_drm_format *fmt = *ptr;
if (modifier == DRM_FORMAT_MOD_INVALID) {
return true;
@@ -75,17 +75,17 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
if (fmt->len == fmt->cap) {
size_t cap = fmt->cap ? fmt->cap * 2 : 4;
- newfmt = realloc(fmt, sizeof(*fmt) + sizeof(fmt->modifiers[0]) * cap);
- if (!newfmt) {
+ fmt = realloc(fmt, sizeof(*fmt) + sizeof(fmt->modifiers[0]) * cap);
+ if (!fmt) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
return false;
}
- newfmt->cap = cap;
- *ptr = newfmt;
+ fmt->cap = cap;
+ *ptr = fmt;
}
- newfmt->modifiers[newfmt->len++] = modifier;
+ fmt->modifiers[fmt->len++] = modifier;
return true;
}