diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-04-09 02:48:04 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-04-09 02:48:04 -0400 |
commit | 682d7b55699cacbb2dbcd84a5e816bf6e2d2f02a (patch) | |
tree | a5f2d3b16723a42c7b745177fd8ea444ed373271 /Xext/xselinux.c | |
parent | 3a0ee199dcec39596756a995996eac388acf6315 (diff) |
xselinux: Don't BadAlloc in List* requests if there are no items to list.
Diffstat (limited to 'Xext/xselinux.c')
-rw-r--r-- | Xext/xselinux.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 399e28ad4..2c7262140 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -1567,7 +1567,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, CARD32 *buf; buf = xcalloc(size, sizeof(CARD32)); - if (!buf) { + if (size && !buf) { rc = BadAlloc; goto out; } @@ -1639,7 +1639,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 */ @@ -1673,7 +1673,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 */ |