mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
c/main: Don't use list of display if we fail to allocate it
This commit is contained in:
parent
4a2eebdc69
commit
141046585d
|
@ -177,8 +177,13 @@ append_nvidia_entry_on_match(struct comp_window_direct_nvidia *w,
|
|||
|
||||
U_ARRAY_REALLOC_OR_FREE(w->displays, struct comp_window_direct_nvidia_display, w->display_count);
|
||||
|
||||
if (w->displays == NULL)
|
||||
COMP_ERROR(w->base.base.c, "Unable to reallocate randr_displays");
|
||||
if (w->displays == NULL) {
|
||||
COMP_ERROR(w->base.base.c, "Unable to reallocate NVIDIA displays");
|
||||
|
||||
// Reset the count.
|
||||
w->display_count = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
w->displays[w->display_count - 1] = d;
|
||||
|
||||
|
|
|
@ -345,9 +345,14 @@ append_randr_display(struct comp_window_direct_randr *w,
|
|||
|
||||
U_ARRAY_REALLOC_OR_FREE(w->displays, struct comp_window_direct_randr_display, w->display_count);
|
||||
|
||||
if (w->displays == NULL)
|
||||
if (w->displays == NULL) {
|
||||
COMP_ERROR(w->base.base.c, "Unable to reallocate randr_displays");
|
||||
|
||||
// Reset the count.
|
||||
w->display_count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
w->displays[w->display_count - 1] = d;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,9 +141,14 @@ append_vk_display_entry(struct comp_window_vk_display *w, struct VkDisplayProper
|
|||
|
||||
U_ARRAY_REALLOC_OR_FREE(w->displays, struct vk_display, w->display_count);
|
||||
|
||||
if (w->displays == NULL)
|
||||
if (w->displays == NULL) {
|
||||
COMP_ERROR(w->base.base.c, "Unable to reallocate vk_display displays");
|
||||
|
||||
// Reset the count.
|
||||
w->display_count = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
w->displays[w->display_count - 1] = d;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue