Commit a92efe9a authored by Marek Chalupa's avatar Marek Chalupa Committed by Pekka Paalanen
Browse files

server: move memset after check

If the malloc fails, memset would touch invalid memory.
Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <>
parent e2c0d47b
......@@ -1141,10 +1141,11 @@ wl_display_add_socket_auto(struct wl_display *display)
const int MAX_DISPLAYNO = 32;
s = malloc(sizeof *s);
memset(s, 0, sizeof *s);
if (s == NULL)
return NULL;
memset(s, 0, sizeof *s);
do {
snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
if (wl_socket_init_for_display_name(s, display_name) < 0) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment