diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index a2d48b630..cd3b2e0a8 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -484,6 +484,8 @@ vfbInstallColormap(ColormapPtr pmap) ppix = calloc(entries, sizeof(Pixel)); prgb = calloc(entries, sizeof(xrgb)); defs = calloc(entries, sizeof(xColorItem)); + if (!ppix || !prgb || !defs) + goto out; for (i = 0; i < entries; i++) ppix[i] = i; @@ -499,6 +501,7 @@ vfbInstallColormap(ColormapPtr pmap) } (*pmap->pScreen->StoreColors) (pmap, entries, defs); +out: free(ppix); free(prgb); free(defs);