diff options
author | emersion <contact@emersion.fr> | 2018-04-03 10:36:22 -0400 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-03 10:36:22 -0400 |
commit | 1cd7ff7d3ab1cb922e4064ee77db453064cccb5b (patch) | |
tree | cc67b69c62ecddd6e9aaf1beb7104f4a11989e10 /xwayland | |
parent | d7e03c7adccad6e175674c5552ff6aac299a8e79 (diff) |
xwayland: use strndup in xwm_get_atom_name
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 7 |
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; } |