The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: Don't use list of display if we fail to allocate it

authored by

Jakob Bornecrantz and committed by
Simon Zeni
14104658 4a2eebdc

+19 -4
+7 -2
src/xrt/compositor/main/comp_window_direct_nvidia.c
··· 177 177 178 178 U_ARRAY_REALLOC_OR_FREE(w->displays, struct comp_window_direct_nvidia_display, w->display_count); 179 179 180 - if (w->displays == NULL) 181 - COMP_ERROR(w->base.base.c, "Unable to reallocate randr_displays"); 180 + if (w->displays == NULL) { 181 + COMP_ERROR(w->base.base.c, "Unable to reallocate NVIDIA displays"); 182 + 183 + // Reset the count. 184 + w->display_count = 0; 185 + return false; 186 + } 182 187 183 188 w->displays[w->display_count - 1] = d; 184 189
+6 -1
src/xrt/compositor/main/comp_window_direct_randr.c
··· 345 345 346 346 U_ARRAY_REALLOC_OR_FREE(w->displays, struct comp_window_direct_randr_display, w->display_count); 347 347 348 - if (w->displays == NULL) 348 + if (w->displays == NULL) { 349 349 COMP_ERROR(w->base.base.c, "Unable to reallocate randr_displays"); 350 + 351 + // Reset the count. 352 + w->display_count = 0; 353 + return; 354 + } 350 355 351 356 w->displays[w->display_count - 1] = d; 352 357 }
+6 -1
src/xrt/compositor/main/comp_window_vk_display.c
··· 141 141 142 142 U_ARRAY_REALLOC_OR_FREE(w->displays, struct vk_display, w->display_count); 143 143 144 - if (w->displays == NULL) 144 + if (w->displays == NULL) { 145 145 COMP_ERROR(w->base.base.c, "Unable to reallocate vk_display displays"); 146 + 147 + // Reset the count. 148 + w->display_count = 0; 149 + return false; 150 + } 146 151 147 152 w->displays[w->display_count - 1] = d; 148 153