mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-06 03:28:11 +02:00
Xvfb: handle allocation failure in vfbInstallColormap()
Reported in #1817: xwayland-24.1.6/redhat-linux-build/../hw/vfb/InitOutput.c:416:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ppix’ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
16ca2c7a11
commit
f8dc6361fa
1 changed files with 13 additions and 12 deletions
|
|
@ -480,20 +480,21 @@ vfbInstallColormap(ColormapPtr pmap)
|
||||||
prgb = xallocarray(entries, sizeof(xrgb));
|
prgb = xallocarray(entries, sizeof(xrgb));
|
||||||
defs = xallocarray(entries, sizeof(xColorItem));
|
defs = xallocarray(entries, sizeof(xColorItem));
|
||||||
|
|
||||||
for (i = 0; i < entries; i++)
|
if (ppix && prgb && defs) {
|
||||||
ppix[i] = i;
|
for (i = 0; i < entries; i++)
|
||||||
/* XXX truecolor */
|
ppix[i] = i;
|
||||||
QueryColors(pmap, entries, ppix, prgb, serverClient);
|
/* XXX truecolor */
|
||||||
|
QueryColors(pmap, entries, ppix, prgb, serverClient);
|
||||||
|
|
||||||
for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
|
for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
|
||||||
defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
|
defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
|
||||||
defs[i].red = prgb[i].red;
|
defs[i].red = prgb[i].red;
|
||||||
defs[i].green = prgb[i].green;
|
defs[i].green = prgb[i].green;
|
||||||
defs[i].blue = prgb[i].blue;
|
defs[i].blue = prgb[i].blue;
|
||||||
defs[i].flags = DoRed | DoGreen | DoBlue;
|
defs[i].flags = DoRed | DoGreen | DoBlue;
|
||||||
|
}
|
||||||
|
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
||||||
}
|
}
|
||||||
(*pmap->pScreen->StoreColors) (pmap, entries, defs);
|
|
||||||
|
|
||||||
free(ppix);
|
free(ppix);
|
||||||
free(prgb);
|
free(prgb);
|
||||||
free(defs);
|
free(defs);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue