mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-09 13:08:12 +02:00
panoramiX: fail if we can't allocate our visual arrays
This code has failed for decades by triggering a segfault, let's not bother figuring out the perfect cleanup path. Co-Authored-by: Claude Code <noreply@anthropic.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
This commit is contained in:
parent
cf85a4e9ce
commit
532987415e
1 changed files with 5 additions and 5 deletions
|
|
@ -781,16 +781,16 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
|||
/* found a matching visual on all screens, add it to the subset list */
|
||||
j = PanoramiXNumVisuals;
|
||||
PanoramiXNumVisuals++;
|
||||
PanoramiXVisuals = reallocarray(PanoramiXVisuals,
|
||||
PanoramiXNumVisuals, sizeof(VisualRec));
|
||||
PanoramiXVisuals = XNFreallocarray(PanoramiXVisuals,
|
||||
PanoramiXNumVisuals, sizeof(VisualRec));
|
||||
|
||||
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
|
||||
|
||||
for (k = 0; k < PanoramiXNumDepths; k++) {
|
||||
if (PanoramiXDepths[k].depth == pVisual->nplanes) {
|
||||
PanoramiXDepths[k].vids = reallocarray(PanoramiXDepths[k].vids,
|
||||
PanoramiXDepths[k].numVids + 1,
|
||||
sizeof(VisualID));
|
||||
PanoramiXDepths[k].vids = XNFreallocarray(PanoramiXDepths[k].vids,
|
||||
PanoramiXDepths[k].numVids + 1,
|
||||
sizeof(VisualID));
|
||||
PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
|
||||
PanoramiXDepths[k].numVids++;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue