aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r--xwayland/xwm.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 0b7c62b4..54172343 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -517,12 +517,7 @@ char *xwm_get_atom_name(struct wlr_xwm *xwm, xcb_atom_t atom) {
}
size_t len = xcb_get_atom_name_name_length(name_reply);
char *buf = xcb_get_atom_name_name(name_reply); // not a C string
- char *name = malloc((len + 1) * sizeof(char));
- if (name == NULL) {
- return NULL;
- }
- memcpy(name, buf, len);
- name[len] = '\0';
+ char *name = strndup(buf, len);
free(name_reply);
return name;
}