mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-10 03:10:37 +01:00
randr: check for malloc failure
This commit is contained in:
parent
21a2df9f35
commit
1b244feb4c
1 changed files with 4 additions and 0 deletions
|
|
@ -120,6 +120,10 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
|
|||
/* Preallocate gamma at a sensible size. */
|
||||
crtc->gamma_size = 256;
|
||||
crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
|
||||
if (!crtc->gamma_red) {
|
||||
xfree (crtc);
|
||||
return NULL;
|
||||
}
|
||||
crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
|
||||
crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue