diff --git a/record/record.c b/record/record.c index a345798bb..428a70e5c 100644 --- a/record/record.c +++ b/record/record.c @@ -117,7 +117,7 @@ typedef struct _RecordClientsAndProtocolRec { short sizeClients; /* size of pClientIDs array */ unsigned int clientStarted:1; /* record new client connections? */ unsigned int clientDied:1; /* record client disconnections? */ - unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */ + unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs calloced? */ } RecordClientsAndProtocolRec, *RecordClientsAndProtocolPtr; /* how much bigger to make pRCAP->pClientIDs when reallocing */ @@ -871,8 +871,7 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient) RecordClientPrivatePtr pClientPriv; /* no Record proc vector; allocate one */ - pClientPriv = (RecordClientPrivatePtr) - malloc(sizeof(RecordClientPrivateRec)); + pClientPriv = calloc(1, sizeof(RecordClientPrivateRec)); if (!pClientPriv) return BadAlloc; /* copy old proc vector to new */ @@ -1190,7 +1189,7 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, * - XRecordCurrentClients expanded to a list of all currently * connected clients - excludespec (if non-zero) * The returned array may be the passed array modified in place, or - * it may be an malloc'ed array. The caller should keep a pointer to the + * it may be an calloc'ed array. The caller should keep a pointer to the * original array and free the returned array if it is different. * * *pNumClientspecs is set to the number of elements in the returned @@ -1547,7 +1546,6 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, int nClients; int sizeClients; int totRCAPsize; - RecordClientsAndProtocolPtr pRCAP; int pad; XID recordingClient; @@ -1685,7 +1683,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, /* allocate memory for the whole RCAP */ - pRCAP = (RecordClientsAndProtocolPtr) malloc(totRCAPsize); + RecordClientsAndProtocolPtr pRCAP = calloc(1, totRCAPsize); if (!pRCAP) { err = BadAlloc; goto bailout; @@ -1838,14 +1836,13 @@ static int ProcRecordCreateContext(ClientPtr client) { REQUEST(xRecordCreateContextReq); - RecordContextPtr pContext; RecordContextPtr *ppNewAllContexts = NULL; int err = BadAlloc; REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); LEGAL_NEW_RESOURCE(stuff->context, client); - pContext = (RecordContextPtr) malloc(sizeof(RecordContextRec)); + RecordContextPtr pContext = calloc(1, sizeof(RecordContextRec)); if (!pContext) goto bailout; @@ -2637,7 +2634,7 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci) int restsize = pci->prefix->length * 4; if (pci->client->swapped) { - char *pConnSetup = (char *) malloc(prefixsize + restsize); + char *pConnSetup = calloc(1, prefixsize + restsize); if (!pConnSetup) return; diff --git a/record/set.c b/record/set.c index e623b7c69..7a86d7b12 100644 --- a/record/set.c +++ b/record/set.c @@ -355,7 +355,7 @@ IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals, } else { prls = (IntervalListSetPtr) - malloc(sizeof(IntervalListSet) + + calloc(1, sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval)); if (!prls) goto bailout;