summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-12-18 16:11:21 +0100
committerMaarten Maathuis <madman2003@gmail.com>2008-12-18 16:12:12 +0100
commit1b244feb4cf11d1cdba79fbead50035965535552 (patch)
tree2931d22b1f3d5f8052e1405bab3c24638a12c9cf
parent21a2df9f359584e634dc12d8602401d54defd7db (diff)
randr: check for malloc failure
-rw-r--r--hw/xfree86/modes/xf86Crtc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index c710b060e..309eb99a5 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -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;