xvfb: protect from memory allocation failure

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-24 13:57:27 +01:00
parent f0257bfe93
commit b32cd8c759

View File

@ -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);