mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-29 08:00:15 +01:00
xselinux: Don't BadAlloc in List* requests if there are no items to list.
(cherry picked from commit 682d7b5569)
This commit is contained in:
parent
feb01d7d6e
commit
50894e1354
1 changed files with 3 additions and 3 deletions
|
|
@ -1570,7 +1570,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
|
|||
CARD32 *buf;
|
||||
|
||||
buf = xcalloc(size, sizeof(CARD32));
|
||||
if (!buf) {
|
||||
if (size && !buf) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -1642,7 +1642,7 @@ ProcSELinuxListProperties(ClientPtr client)
|
|||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
count++;
|
||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||
if (!items)
|
||||
if (count && !items)
|
||||
return BadAlloc;
|
||||
|
||||
/* Fill in the items and calculate size */
|
||||
|
|
@ -1676,7 +1676,7 @@ ProcSELinuxListSelections(ClientPtr client)
|
|||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
count++;
|
||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||
if (!items)
|
||||
if (count && !items)
|
||||
return BadAlloc;
|
||||
|
||||
/* Fill in the items and calculate size */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue