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 committed by Enrico Weigelt, metux IT consult .
parent 7f60953188
commit 654c7ce1df

View File

@ -486,6 +486,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;
@ -501,6 +503,7 @@ vfbInstallColormap(ColormapPtr pmap)
}
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
out:
free(ppix);
free(prgb);
free(defs);