diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index dd5ace348..4cce3d2a0 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -450,8 +450,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 */