diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 99501eeef..7acc39bbb 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -452,8 +452,10 @@ ProcSELinuxListSelections(ClientPtr client) count = 0; for (pSel = CurrentSelections; pSel; pSel = pSel->next) count++; + if (count == 0) + return SELinuxSendItemsToClient(client, NULL, 0, 0); items = calloc(count, sizeof(SELinuxListItemRec)); - if (count && !items) + if (!items) return BadAlloc; /* Fill in the items and calculate size */