xvfb: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
f0257bfe93
commit
b32cd8c759
|
@ -484,6 +484,8 @@ vfbInstallColormap(ColormapPtr pmap)
|
||||||
ppix = calloc(entries, sizeof(Pixel));
|
ppix = calloc(entries, sizeof(Pixel));
|
||||||
prgb = calloc(entries, sizeof(xrgb));
|
prgb = calloc(entries, sizeof(xrgb));
|
||||||
defs = calloc(entries, sizeof(xColorItem));
|
defs = calloc(entries, sizeof(xColorItem));
|
||||||
|
if (!ppix || !prgb || !defs)
|
||||||
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < entries; i++)
|
for (i = 0; i < entries; i++)
|
||||||
ppix[i] = i;
|
ppix[i] = i;
|
||||||
|
@ -499,6 +501,7 @@ vfbInstallColormap(ColormapPtr pmap)
|
||||||
}
|
}
|
||||||
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
||||||
|
|
||||||
|
out:
|
||||||
free(ppix);
|
free(ppix);
|
||||||
free(prgb);
|
free(prgb);
|
||||||
free(defs);
|
free(defs);
|
||||||
|
|
Loading…
Reference in New Issue