diff options
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86sbusBus.c')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86sbusBus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c index b6a6b94b3..07eb71ed8 100644 --- a/xorg-server/hw/xfree86/common/xf86sbusBus.c +++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c @@ -641,14 +641,16 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, int i, index; sbusCmapPtr cmap; struct fbcmap fbcmap; - unsigned char *data = malloc(numColors * 3); + unsigned char *data; cmap = SBUSCMAPPTR(pScrn->pScreen); if (!cmap) return; fbcmap.count = 0; fbcmap.index = indices[0]; - fbcmap.red = data; + fbcmap.red = data = malloc(numColors * 3); + if (!data) + return; fbcmap.green = data + numColors; fbcmap.blue = fbcmap.green + numColors; for (i = 0; i < numColors; i++) { |