Record: Remove usage of alloca
Replace with xalloc/xfree.
This commit is contained in:
parent
e0491f470e
commit
3c1d2fdeff
|
@ -1724,7 +1724,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
|
||||||
* range for extension replies.
|
* range for extension replies.
|
||||||
*/
|
*/
|
||||||
maxSets = PREDEFSETS + 2 * stuff->nRanges;
|
maxSets = PREDEFSETS + 2 * stuff->nRanges;
|
||||||
si = (SetInfoPtr)ALLOCATE_LOCAL(sizeof(SetInfoRec) * maxSets);
|
si = (SetInfoPtr)xalloc(sizeof(SetInfoRec) * maxSets);
|
||||||
if (!si)
|
if (!si)
|
||||||
{
|
{
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
|
@ -1931,7 +1931,7 @@ bailout:
|
||||||
for (i = 0; i < maxSets; i++)
|
for (i = 0; i < maxSets; i++)
|
||||||
if (si[i].intervals)
|
if (si[i].intervals)
|
||||||
xfree(si[i].intervals);
|
xfree(si[i].intervals);
|
||||||
DEALLOCATE_LOCAL(si);
|
xfree(si);
|
||||||
}
|
}
|
||||||
if (pCanonClients && pCanonClients != (XID *)&stuff[1])
|
if (pCanonClients && pCanonClients != (XID *)&stuff[1])
|
||||||
xfree(pCanonClients);
|
xfree(pCanonClients);
|
||||||
|
@ -2298,7 +2298,7 @@ ProcRecordGetContext(ClientPtr client)
|
||||||
|
|
||||||
/* allocate and initialize space for record range info */
|
/* allocate and initialize space for record range info */
|
||||||
|
|
||||||
pRangeInfo = (GetContextRangeInfoPtr)ALLOCATE_LOCAL(
|
pRangeInfo = (GetContextRangeInfoPtr)xalloc(
|
||||||
nRCAPs * sizeof(GetContextRangeInfoRec));
|
nRCAPs * sizeof(GetContextRangeInfoRec));
|
||||||
if (!pRangeInfo && nRCAPs > 0)
|
if (!pRangeInfo && nRCAPs > 0)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -2415,7 +2415,7 @@ bailout:
|
||||||
{
|
{
|
||||||
if (pRangeInfo[i].pRanges) xfree(pRangeInfo[i].pRanges);
|
if (pRangeInfo[i].pRanges) xfree(pRangeInfo[i].pRanges);
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(pRangeInfo);
|
xfree(pRangeInfo);
|
||||||
return err;
|
return err;
|
||||||
} /* ProcRecordGetContext */
|
} /* ProcRecordGetContext */
|
||||||
|
|
||||||
|
@ -2815,14 +2815,14 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
|
||||||
|
|
||||||
if (pci->client->swapped)
|
if (pci->client->swapped)
|
||||||
{
|
{
|
||||||
char *pConnSetup = (char *)ALLOCATE_LOCAL(prefixsize + restsize);
|
char *pConnSetup = (char *)xalloc(prefixsize + restsize);
|
||||||
if (!pConnSetup)
|
if (!pConnSetup)
|
||||||
return;
|
return;
|
||||||
SwapConnSetupPrefix(pci->prefix, pConnSetup);
|
SwapConnSetupPrefix(pci->prefix, pConnSetup);
|
||||||
SwapConnSetupInfo(pci->setup, pConnSetup + prefixsize);
|
SwapConnSetupInfo(pci->setup, pConnSetup + prefixsize);
|
||||||
RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
|
RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
|
||||||
(pointer)pConnSetup, prefixsize + restsize, 0);
|
(pointer)pConnSetup, prefixsize + restsize, 0);
|
||||||
DEALLOCATE_LOCAL(pConnSetup);
|
xfree(pConnSetup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -302,7 +302,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
|
||||||
|
|
||||||
if (nIntervals > 0)
|
if (nIntervals > 0)
|
||||||
{
|
{
|
||||||
stackIntervals = (RecordSetInterval *)ALLOCATE_LOCAL(
|
stackIntervals = (RecordSetInterval *)xalloc(
|
||||||
sizeof(RecordSetInterval) * nIntervals);
|
sizeof(RecordSetInterval) * nIntervals);
|
||||||
if (!stackIntervals) return NULL;
|
if (!stackIntervals) return NULL;
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
|
||||||
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|
||||||
prls->nIntervals = nIntervals;
|
prls->nIntervals = nIntervals;
|
||||||
bailout:
|
bailout:
|
||||||
if (stackIntervals) DEALLOCATE_LOCAL(stackIntervals);
|
if (stackIntervals) xfree(stackIntervals);
|
||||||
return (RecordSetPtr)prls;
|
return (RecordSetPtr)prls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue