diff --git a/Xext/xres.c b/Xext/xres.c index 61740127d..dc1fd2271 100644 --- a/Xext/xres.c +++ b/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);