diff --git a/hw/xfree86/int10/vbe.c b/hw/xfree86/int10/vbe.c index 7edc2eb34..ffaffc81b 100644 --- a/hw/xfree86/int10/vbe.c +++ b/hw/xfree86/int10/vbe.c @@ -375,6 +375,8 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) return NULL; block = calloc(1, sizeof(VbeInfoBlock)); + if (!block) + return NULL; block->VESASignature[0] = ((char *) pVbe->memory)[0]; block->VESASignature[1] = ((char *) pVbe->memory)[1]; block->VESASignature[2] = ((char *) pVbe->memory)[2]; @@ -397,7 +399,8 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) i = 0; while (modes[i] != 0xffff) i++; - block->VideoModePtr = calloc(i + 1, sizeof(CARD16)); + if (!(block->VideoModePtr = calloc(i + 1, sizeof(CARD16)))) + return NULL; memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); block->VideoModePtr[i] = 0xffff; @@ -806,7 +809,8 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, if (set) return data; - data = calloc(num, sizeof(CARD32)); + if (!(data = calloc(num, sizeof(CARD32)))) + return NULL; memcpy(data, pVbe->memory, num * sizeof(CARD32)); return data; diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index ab089d45f..822a20584 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1153,6 +1153,8 @@ xf86RandR12CrtcSet(ScreenPtr pScreen, return FALSE; save_crtcs = calloc(config->num_output, sizeof(xf86CrtcPtr)); + if (!save_crtcs) + return FALSE; if ((randr_mode != NULL) != crtc->enabled) changed = TRUE; else if (randr_mode && !xf86RandRModeMatches(randr_mode, &crtc->mode)) @@ -1652,6 +1654,11 @@ xf86RandR12SetInfo12(ScreenPtr pScreen) clones = calloc(config->num_output, sizeof(RROutputPtr)); crtcs = calloc(config->num_crtc, sizeof(RRCrtcPtr)); + if (!clones || !crtcs) { + free(clones); + free(crtcs); + return FALSE; + } for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o];