mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-02-16 17:22:43 +00:00
xwayland/xwm: Avoid zero-size allocaiton
Zero-sized allocations have glibc-specific behavior, so avoid those.
This commit is contained in:
parent
0cb091f1a2
commit
837060f894
@ -290,15 +290,18 @@ static void xwm_set_net_client_list(struct wlr_xwm *xwm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_window_t *windows = malloc(sizeof(xcb_window_t) * mapped_surfaces);
|
xcb_window_t *windows = NULL;
|
||||||
if (!windows) {
|
if (mapped_surfaces > 0) {
|
||||||
return;
|
xcb_window_t *windows = malloc(sizeof(*windows) * mapped_surfaces);
|
||||||
}
|
if (!windows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
wl_list_for_each(surface, &xwm->surfaces, link) {
|
wl_list_for_each(surface, &xwm->surfaces, link) {
|
||||||
if (surface->surface != NULL && surface->surface->mapped) {
|
if (surface->surface != NULL && surface->surface->mapped) {
|
||||||
windows[index++] = surface->window_id;
|
windows[index++] = surface->window_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user