xext: xres: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
dda64fcadf
commit
01d6efb414
10
Xext/xres.c
10
Xext/xres.c
|
@ -221,12 +221,13 @@ ProcXResQueryClients(ClientPtr client)
|
|||
{
|
||||
/* REQUEST(xXResQueryClientsReq); */
|
||||
xXResQueryClientsReply rep;
|
||||
int *current_clients;
|
||||
int i, num_clients;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||
|
||||
current_clients = calloc(currentMaxClients, sizeof(int));
|
||||
int *current_clients = calloc(currentMaxClients, sizeof(int));
|
||||
if (!current_clients)
|
||||
return BadAlloc;
|
||||
|
||||
num_clients = 0;
|
||||
for (i = 0; i < currentMaxClients; i++) {
|
||||
|
@ -303,7 +304,6 @@ ProcXResQueryClientResources(ClientPtr client)
|
|||
REQUEST(xXResQueryClientResourcesReq);
|
||||
xXResQueryClientResourcesReply rep;
|
||||
int i, num_types;
|
||||
int *counts;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
|
||||
|
||||
|
@ -316,7 +316,9 @@ ProcXResQueryClientResources(ClientPtr client)
|
|||
return BadValue;
|
||||
}
|
||||
|
||||
counts = calloc(lastResourceType + 1, sizeof(int));
|
||||
int *counts = calloc(lastResourceType + 1, sizeof(int));
|
||||
if (!counts)
|
||||
return BadAlloc;
|
||||
|
||||
FindAllClientResources(resClient, ResFindAllRes, counts);
|
||||
|
||||
|
|
Loading…
Reference in New Issue