xselinux: Don't BadAlloc in List* requests if there are no items to list.
This commit is contained in:
parent
3a0ee199dc
commit
682d7b5569
|
@ -1567,7 +1567,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
|
||||||
CARD32 *buf;
|
CARD32 *buf;
|
||||||
|
|
||||||
buf = xcalloc(size, sizeof(CARD32));
|
buf = xcalloc(size, sizeof(CARD32));
|
||||||
if (!buf) {
|
if (size && !buf) {
|
||||||
rc = BadAlloc;
|
rc = BadAlloc;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1639,7 @@ ProcSELinuxListProperties(ClientPtr client)
|
||||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||||
count++;
|
count++;
|
||||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||||
if (!items)
|
if (count && !items)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
/* Fill in the items and calculate size */
|
/* Fill in the items and calculate size */
|
||||||
|
@ -1673,7 +1673,7 @@ ProcSELinuxListSelections(ClientPtr client)
|
||||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||||
count++;
|
count++;
|
||||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||||
if (!items)
|
if (count && !items)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
/* Fill in the items and calculate size */
|
/* Fill in the items and calculate size */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user