Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -158,7 +158,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
|
||||
if (pScreen->myNum == 0)
|
||||
REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
|
||||
|
||||
xfree ((pointer) pScreenPriv);
|
||||
free((pointer) pScreenPriv);
|
||||
|
||||
return (*pScreen->CloseScreen) (i, pScreen);
|
||||
}
|
||||
@@ -328,7 +328,7 @@ XineramaDestroyClip(GCPtr pGC)
|
||||
int
|
||||
XineramaDeleteResource(pointer data, XID id)
|
||||
{
|
||||
xfree(data);
|
||||
free(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
|
||||
{
|
||||
XineramaConnectionCallbackList *newlist;
|
||||
|
||||
if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
|
||||
if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
|
||||
return FALSE;
|
||||
|
||||
newlist->next = ConnectionCallbackList;
|
||||
@@ -474,7 +474,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||
*/
|
||||
|
||||
panoramiXdataPtr = (PanoramiXData *)
|
||||
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
|
||||
calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
|
||||
|
||||
if (!panoramiXdataPtr)
|
||||
break;
|
||||
@@ -486,7 +486,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||
|
||||
for (i = 0; i < PanoramiXNumScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
|
||||
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
|
||||
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
|
||||
pScreenPriv);
|
||||
if(!pScreenPriv) {
|
||||
@@ -675,8 +675,8 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||
connSetupPrefix.length = bytes_to_int32(length);
|
||||
|
||||
for (i = 0; i < PanoramiXNumDepths; i++)
|
||||
xfree(PanoramiXDepths[i].vids);
|
||||
xfree(PanoramiXDepths);
|
||||
free(PanoramiXDepths[i].vids);
|
||||
free(PanoramiXDepths);
|
||||
PanoramiXDepths = NULL;
|
||||
|
||||
/*
|
||||
@@ -699,7 +699,7 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||
tmp = (pointer)ConnectionCallbackList;
|
||||
(*ConnectionCallbackList->func)();
|
||||
ConnectionCallbackList = ConnectionCallbackList->next;
|
||||
xfree(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -750,13 +750,13 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
||||
|
||||
j = PanoramiXNumDepths;
|
||||
PanoramiXNumDepths++;
|
||||
PanoramiXDepths = xrealloc(PanoramiXDepths,
|
||||
PanoramiXDepths = realloc(PanoramiXDepths,
|
||||
PanoramiXNumDepths * sizeof(DepthRec));
|
||||
PanoramiXDepths[j].depth = pDepth->depth;
|
||||
PanoramiXDepths[j].numVids = 0;
|
||||
/* XXX suboptimal, should grow these dynamically */
|
||||
if(pDepth->numVids)
|
||||
PanoramiXDepths[j].vids = xalloc(sizeof(VisualID) * pDepth->numVids);
|
||||
PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
|
||||
else
|
||||
PanoramiXDepths[j].vids = NULL;
|
||||
}
|
||||
@@ -792,7 +792,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
||||
/* found a matching visual on all screens, add it to the subset list */
|
||||
j = PanoramiXNumVisuals;
|
||||
PanoramiXNumVisuals++;
|
||||
PanoramiXVisuals = xrealloc(PanoramiXVisuals,
|
||||
PanoramiXVisuals = realloc(PanoramiXVisuals,
|
||||
PanoramiXNumVisuals * sizeof(VisualRec));
|
||||
|
||||
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
|
||||
@@ -824,11 +824,11 @@ PanoramiXConsolidate(void)
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
PanoramiXMaybeAddVisual(pVisual++);
|
||||
|
||||
root = xalloc(sizeof(PanoramiXRes));
|
||||
root = malloc(sizeof(PanoramiXRes));
|
||||
root->type = XRT_WINDOW;
|
||||
defmap = xalloc(sizeof(PanoramiXRes));
|
||||
defmap = malloc(sizeof(PanoramiXRes));
|
||||
defmap->type = XRT_COLORMAP;
|
||||
saver = xalloc(sizeof(PanoramiXRes));
|
||||
saver = malloc(sizeof(PanoramiXRes));
|
||||
saver->type = XRT_WINDOW;
|
||||
|
||||
for (i = 0; i < PanoramiXNumScreens; i++) {
|
||||
@@ -893,7 +893,7 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
|
||||
for (i = 256; i--; )
|
||||
ProcVector[i] = SavedProcVector[i];
|
||||
|
||||
Xfree(panoramiXdataPtr);
|
||||
free(panoramiXdataPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1202,7 +1202,7 @@ XineramaGetImageData(
|
||||
|
||||
if(sizeNeeded > size) {
|
||||
char *tmpdata = ScratchMem;
|
||||
ScratchMem = xrealloc(ScratchMem, sizeNeeded);
|
||||
ScratchMem = realloc(ScratchMem, sizeNeeded);
|
||||
if(ScratchMem)
|
||||
size = sizeNeeded;
|
||||
else {
|
||||
@@ -1277,7 +1277,7 @@ XineramaGetImageData(
|
||||
}
|
||||
|
||||
if(ScratchMem)
|
||||
xfree(ScratchMem);
|
||||
free(ScratchMem);
|
||||
|
||||
REGION_UNINIT(pScreen, &SrcRegion);
|
||||
REGION_UNINIT(pScreen, &GrabRegion);
|
||||
|
||||
@@ -120,7 +120,7 @@ int PanoramiXCreateWindow(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
if(!(newWin = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newWin = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newWin->type = XRT_WINDOW;
|
||||
@@ -160,7 +160,7 @@ int PanoramiXCreateWindow(ClientPtr client)
|
||||
if (result == Success)
|
||||
AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
|
||||
else
|
||||
xfree(newWin);
|
||||
free(newWin);
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -666,7 +666,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newPix = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newPix->type = XRT_PIXMAP;
|
||||
@@ -685,7 +685,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
|
||||
if (result == Success)
|
||||
AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
|
||||
else
|
||||
xfree(newPix);
|
||||
free(newPix);
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -771,7 +771,7 @@ int PanoramiXCreateGC(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
if(!(newGC = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newGC = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newGC->type = XRT_GC;
|
||||
@@ -795,7 +795,7 @@ int PanoramiXCreateGC(ClientPtr client)
|
||||
if (result == Success)
|
||||
AddResource(newGC->info[0].id, XRT_GC, newGC);
|
||||
else
|
||||
xfree(newGC);
|
||||
free(newGC);
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ int PanoramiXCopyArea(ClientPtr client)
|
||||
}
|
||||
|
||||
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
|
||||
if(!(data = xcalloc(1, stuff->height * pitch)))
|
||||
if(!(data = calloc(1, stuff->height * pitch)))
|
||||
return BadAlloc;
|
||||
|
||||
XineramaGetImageData(drawables, srcx, srcy,
|
||||
@@ -1076,7 +1076,7 @@ int PanoramiXCopyArea(ClientPtr client)
|
||||
VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess);
|
||||
if(drawables[0]->depth != pDst->depth) {
|
||||
client->errorValue = stuff->dstDrawable;
|
||||
xfree(data);
|
||||
free(data);
|
||||
return (BadMatch);
|
||||
}
|
||||
|
||||
@@ -1087,7 +1087,7 @@ int PanoramiXCopyArea(ClientPtr client)
|
||||
if(dstShared) break;
|
||||
}
|
||||
|
||||
xfree(data);
|
||||
free(data);
|
||||
|
||||
result = Success;
|
||||
} else {
|
||||
@@ -1301,7 +1301,7 @@ int PanoramiXPolyPoint(ClientPtr client)
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
|
||||
if (npoint > 0) {
|
||||
origPts = xalloc(npoint * sizeof(xPoint));
|
||||
origPts = malloc(npoint * sizeof(xPoint));
|
||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1328,7 +1328,7 @@ int PanoramiXPolyPoint(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyPoint])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origPts);
|
||||
free(origPts);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1361,7 +1361,7 @@ int PanoramiXPolyLine(ClientPtr client)
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
|
||||
if (npoint > 0){
|
||||
origPts = xalloc(npoint * sizeof(xPoint));
|
||||
origPts = malloc(npoint * sizeof(xPoint));
|
||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1388,7 +1388,7 @@ int PanoramiXPolyLine(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyLine])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origPts);
|
||||
free(origPts);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1424,7 +1424,7 @@ int PanoramiXPolySegment(ClientPtr client)
|
||||
if(nsegs & 4) return BadLength;
|
||||
nsegs >>= 3;
|
||||
if (nsegs > 0) {
|
||||
origSegs = xalloc(nsegs * sizeof(xSegment));
|
||||
origSegs = malloc(nsegs * sizeof(xSegment));
|
||||
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1451,7 +1451,7 @@ int PanoramiXPolySegment(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolySegment])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origSegs);
|
||||
free(origSegs);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1487,7 +1487,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
|
||||
if(nrects & 4) return BadLength;
|
||||
nrects >>= 3;
|
||||
if (nrects > 0){
|
||||
origRecs = xalloc(nrects * sizeof(xRectangle));
|
||||
origRecs = malloc(nrects * sizeof(xRectangle));
|
||||
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1513,7 +1513,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyRectangle])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origRecs);
|
||||
free(origRecs);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1549,7 +1549,7 @@ int PanoramiXPolyArc(ClientPtr client)
|
||||
if(narcs % sizeof(xArc)) return BadLength;
|
||||
narcs /= sizeof(xArc);
|
||||
if (narcs > 0){
|
||||
origArcs = xalloc(narcs * sizeof(xArc));
|
||||
origArcs = malloc(narcs * sizeof(xArc));
|
||||
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1573,7 +1573,7 @@ int PanoramiXPolyArc(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyArc])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origArcs);
|
||||
free(origArcs);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1607,7 +1607,7 @@ int PanoramiXFillPoly(ClientPtr client)
|
||||
|
||||
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
|
||||
if (count > 0){
|
||||
locPts = xalloc(count * sizeof(DDXPointRec));
|
||||
locPts = malloc(count * sizeof(DDXPointRec));
|
||||
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1634,7 +1634,7 @@ int PanoramiXFillPoly(ClientPtr client)
|
||||
result = (* SavedProcVector[X_FillPoly])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(locPts);
|
||||
free(locPts);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1670,7 +1670,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
|
||||
if(things & 4) return BadLength;
|
||||
things >>= 3;
|
||||
if (things > 0){
|
||||
origRects = xalloc(things * sizeof(xRectangle));
|
||||
origRects = malloc(things * sizeof(xRectangle));
|
||||
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1695,7 +1695,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyFillRectangle])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origRects);
|
||||
free(origRects);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1731,7 +1731,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
|
||||
if (narcs % sizeof(xArc)) return BadLength;
|
||||
narcs /= sizeof(xArc);
|
||||
if (narcs > 0) {
|
||||
origArcs = xalloc(narcs * sizeof(xArc));
|
||||
origArcs = malloc(narcs * sizeof(xArc));
|
||||
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
|
||||
FOR_NSCREENS_FORWARD(j){
|
||||
|
||||
@@ -1756,7 +1756,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
|
||||
result = (* SavedProcVector[X_PolyFillArc])(client);
|
||||
if(result != Success) break;
|
||||
}
|
||||
xfree(origArcs);
|
||||
free(origArcs);
|
||||
return (result);
|
||||
} else
|
||||
return (client->noClientException);
|
||||
@@ -1907,7 +1907,7 @@ int PanoramiXGetImage(ClientPtr client)
|
||||
linesPerBuf = h;
|
||||
}
|
||||
length = linesPerBuf * widthBytesLine;
|
||||
if(!(pBuf = xalloc(length)))
|
||||
if(!(pBuf = malloc(length)))
|
||||
return (BadAlloc);
|
||||
|
||||
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
|
||||
@@ -1953,7 +1953,7 @@ int PanoramiXGetImage(ClientPtr client)
|
||||
}
|
||||
}
|
||||
}
|
||||
xfree(pBuf);
|
||||
free(pBuf);
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
@@ -2141,7 +2141,7 @@ int PanoramiXCreateColormap(ClientPtr client)
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newCmap->type = XRT_COLORMAP;
|
||||
@@ -2161,7 +2161,7 @@ int PanoramiXCreateColormap(ClientPtr client)
|
||||
if (result == Success)
|
||||
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
|
||||
else
|
||||
xfree(newCmap);
|
||||
free(newCmap);
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -2212,7 +2212,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadColor : result;
|
||||
|
||||
if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newCmap->type = XRT_COLORMAP;
|
||||
@@ -2230,7 +2230,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
|
||||
if (result == Success)
|
||||
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
|
||||
else
|
||||
xfree(newCmap);
|
||||
free(newCmap);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
28
Xext/saver.c
28
Xext/saver.c
@@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
|
||||
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
|
||||
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
|
||||
|
||||
#define New(t) (xalloc (sizeof (t)))
|
||||
#define New(t) (malloc(sizeof (t)))
|
||||
|
||||
/****************
|
||||
* ScreenSaverExtensionInit
|
||||
@@ -283,7 +283,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
|
||||
if (!pPriv->attr && !pPriv->events &&
|
||||
!pPriv->hasWindow && pPriv->installedMap == None)
|
||||
{
|
||||
xfree (pPriv);
|
||||
free(pPriv);
|
||||
SetScreenPrivate (pScreen, NULL);
|
||||
savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
|
||||
}
|
||||
@@ -343,7 +343,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
||||
{
|
||||
FreeResource (pEv->resource, SaverEventType);
|
||||
*pPrev = pEv->next;
|
||||
xfree (pEv);
|
||||
free(pEv);
|
||||
CheckScreenPrivate (pScreen);
|
||||
}
|
||||
else
|
||||
@@ -387,8 +387,8 @@ static void
|
||||
FreeScreenAttr (ScreenSaverAttrPtr pAttr)
|
||||
{
|
||||
FreeAttrs (pAttr);
|
||||
xfree (pAttr->values);
|
||||
xfree (pAttr);
|
||||
free(pAttr->values);
|
||||
free(pAttr);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -407,7 +407,7 @@ ScreenSaverFreeEvents (pointer value, XID id)
|
||||
if (!pEv)
|
||||
return TRUE;
|
||||
*pPrev = pEv->next;
|
||||
xfree (pEv);
|
||||
free(pEv);
|
||||
CheckScreenPrivate (pScreen);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ ScreenSaverFreeSuspend (pointer value, XID id)
|
||||
if (this == data)
|
||||
{
|
||||
*prev = this->next;
|
||||
xfree (this);
|
||||
free(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -644,14 +644,14 @@ CreateSaverWindow (ScreenPtr pScreen)
|
||||
wantMap = wColormap (pWin);
|
||||
if (wantMap == None)
|
||||
return TRUE;
|
||||
installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap));
|
||||
installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof (Colormap));
|
||||
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
||||
(pScreen, installedMaps);
|
||||
for (i = 0; i < numInstalled; i++)
|
||||
if (installedMaps[i] == wantMap)
|
||||
break;
|
||||
|
||||
xfree ((char *) installedMaps);
|
||||
free((char *) installedMaps);
|
||||
|
||||
if (i < numInstalled)
|
||||
return TRUE;
|
||||
@@ -982,7 +982,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||
goto bail;
|
||||
}
|
||||
/* over allocate for override redirect */
|
||||
values = xalloc ((len + 1) * sizeof (unsigned long));
|
||||
values = malloc((len + 1) * sizeof (unsigned long));
|
||||
if (!values)
|
||||
{
|
||||
ret = BadAlloc;
|
||||
@@ -1219,8 +1219,8 @@ PatchUp:
|
||||
FreeAttrs (pAttr);
|
||||
bail:
|
||||
CheckScreenPrivate (pScreen);
|
||||
if (pAttr) xfree (pAttr->values);
|
||||
xfree (pAttr);
|
||||
if (pAttr) free(pAttr->values);
|
||||
free(pAttr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1392,7 +1392,7 @@ ProcScreenSaverSuspend (ClientPtr client)
|
||||
* to the record, so the screensaver will be reenabled and the record freed
|
||||
* if the client disconnects without reenabling it first.
|
||||
*/
|
||||
this = xalloc (sizeof (ScreenSaverSuspensionRec));
|
||||
this = malloc(sizeof (ScreenSaverSuspensionRec));
|
||||
|
||||
if (!this)
|
||||
return BadAlloc;
|
||||
@@ -1404,7 +1404,7 @@ ProcScreenSaverSuspend (ClientPtr client)
|
||||
|
||||
if (!AddResource (this->clientResource, SuspendType, (pointer) this))
|
||||
{
|
||||
xfree (this);
|
||||
free(this);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ SecurityDeleteAuthorization(
|
||||
}
|
||||
|
||||
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
|
||||
xfree(pAuth);
|
||||
free(pAuth);
|
||||
return Success;
|
||||
|
||||
} /* SecurityDeleteAuthorization */
|
||||
@@ -247,7 +247,7 @@ SecurityDeleteAuthorizationEventClient(
|
||||
prev->next = pEventClient->next;
|
||||
else
|
||||
pAuth->eventClients = pEventClient->next;
|
||||
xfree(pEventClient);
|
||||
free(pEventClient);
|
||||
return(Success);
|
||||
}
|
||||
prev = pEventClient;
|
||||
@@ -409,7 +409,7 @@ SecurityEventSelectForAuthorization(
|
||||
}
|
||||
}
|
||||
|
||||
pEventClient = xalloc(sizeof(OtherClients));
|
||||
pEventClient = malloc(sizeof(OtherClients));
|
||||
if (!pEventClient)
|
||||
return BadAlloc;
|
||||
pEventClient->mask = mask;
|
||||
@@ -418,7 +418,7 @@ SecurityEventSelectForAuthorization(
|
||||
if (!AddResource(pEventClient->resource, RTEventClient,
|
||||
(pointer)pAuth))
|
||||
{
|
||||
xfree(pEventClient);
|
||||
free(pEventClient);
|
||||
return BadAlloc;
|
||||
}
|
||||
pAuth->eventClients = pEventClient;
|
||||
@@ -541,7 +541,7 @@ ProcSecurityGenerateAuthorization(
|
||||
|
||||
/* associate additional information with this auth ID */
|
||||
|
||||
pAuth = xalloc(sizeof(SecurityAuthorizationRec));
|
||||
pAuth = malloc(sizeof(SecurityAuthorizationRec));
|
||||
if (!pAuth)
|
||||
{
|
||||
err = BadAlloc;
|
||||
@@ -613,7 +613,7 @@ bailout:
|
||||
if (removeAuth)
|
||||
RemoveAuthorization(stuff->nbytesAuthProto, protoname,
|
||||
authdata_len, pAuthdata);
|
||||
if (pAuth) xfree(pAuth);
|
||||
if (pAuth) free(pAuth);
|
||||
return err;
|
||||
|
||||
} /* ProcSecurityGenerateAuthorization */
|
||||
|
||||
18
Xext/shape.c
18
Xext/shape.c
@@ -764,7 +764,7 @@ ShapeFreeClient (pointer data, XID id)
|
||||
*pHead = pShapeEvent->next;
|
||||
}
|
||||
}
|
||||
xfree ((pointer) pShapeEvent);
|
||||
free((pointer) pShapeEvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -778,9 +778,9 @@ ShapeFreeEvents (pointer data, XID id)
|
||||
for (pCur = *pHead; pCur; pCur = pNext) {
|
||||
pNext = pCur->next;
|
||||
FreeResource (pCur->clientResource, ClientType);
|
||||
xfree ((pointer) pCur);
|
||||
free((pointer) pCur);
|
||||
}
|
||||
xfree ((pointer) pHead);
|
||||
free((pointer) pHead);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ ProcShapeSelectInput (ClientPtr client)
|
||||
}
|
||||
|
||||
/* build the entry */
|
||||
pNewShapeEvent = xalloc (sizeof (ShapeEventRec));
|
||||
pNewShapeEvent = malloc(sizeof (ShapeEventRec));
|
||||
if (!pNewShapeEvent)
|
||||
return BadAlloc;
|
||||
pNewShapeEvent->next = 0;
|
||||
@@ -839,7 +839,7 @@ ProcShapeSelectInput (ClientPtr client)
|
||||
*/
|
||||
if (!pHead)
|
||||
{
|
||||
pHead = xalloc (sizeof (ShapeEventPtr));
|
||||
pHead = malloc(sizeof (ShapeEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
|
||||
{
|
||||
@@ -866,7 +866,7 @@ ProcShapeSelectInput (ClientPtr client)
|
||||
pNewShapeEvent->next = pShapeEvent->next;
|
||||
else
|
||||
*pHead = pShapeEvent->next;
|
||||
xfree (pShapeEvent);
|
||||
free(pShapeEvent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1030,7 +1030,7 @@ ProcShapeGetRectangles (ClientPtr client)
|
||||
}
|
||||
if (!region) {
|
||||
nrects = 1;
|
||||
rects = xalloc (sizeof (xRectangle));
|
||||
rects = malloc(sizeof (xRectangle));
|
||||
if (!rects)
|
||||
return BadAlloc;
|
||||
switch (stuff->kind) {
|
||||
@@ -1057,7 +1057,7 @@ ProcShapeGetRectangles (ClientPtr client)
|
||||
BoxPtr box;
|
||||
nrects = REGION_NUM_RECTS(region);
|
||||
box = REGION_RECTS(region);
|
||||
rects = xalloc (nrects * sizeof (xRectangle));
|
||||
rects = malloc(nrects * sizeof (xRectangle));
|
||||
if (!rects && nrects)
|
||||
return BadAlloc;
|
||||
for (i = 0; i < nrects; i++, box++) {
|
||||
@@ -1080,7 +1080,7 @@ ProcShapeGetRectangles (ClientPtr client)
|
||||
}
|
||||
WriteToClient (client, sizeof (rep), (char *) &rep);
|
||||
WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
|
||||
xfree (rects);
|
||||
free(rects);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
||||
22
Xext/shm.c
22
Xext/shm.c
@@ -226,7 +226,7 @@ ShmCloseScreen(int i, ScreenPtr pScreen)
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
pScreen->CloseScreen = screen_priv->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
|
||||
xfree (screen_priv);
|
||||
free(screen_priv);
|
||||
return (*pScreen->CloseScreen) (i, pScreen);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
if (!screen_priv)
|
||||
{
|
||||
screen_priv = xcalloc (1, sizeof (ShmScrPrivateRec));
|
||||
screen_priv = calloc(1, sizeof (ShmScrPrivateRec));
|
||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
||||
pScreen->CloseScreen = ShmCloseScreen;
|
||||
@@ -454,7 +454,7 @@ ProcShmAttach(ClientPtr client)
|
||||
}
|
||||
else
|
||||
{
|
||||
shmdesc = xalloc(sizeof(ShmDescRec));
|
||||
shmdesc = malloc(sizeof(ShmDescRec));
|
||||
if (!shmdesc)
|
||||
return BadAlloc;
|
||||
shmdesc->addr = shmat(stuff->shmid, 0,
|
||||
@@ -462,7 +462,7 @@ ProcShmAttach(ClientPtr client)
|
||||
if ((shmdesc->addr == ((char *)-1)) ||
|
||||
SHMSTAT(stuff->shmid, &buf))
|
||||
{
|
||||
xfree(shmdesc);
|
||||
free(shmdesc);
|
||||
return BadAccess;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ ProcShmAttach(ClientPtr client)
|
||||
|
||||
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
|
||||
shmdt(shmdesc->addr);
|
||||
xfree(shmdesc);
|
||||
free(shmdesc);
|
||||
return BadAccess;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
||||
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
|
||||
;
|
||||
*prev = shmdesc->next;
|
||||
xfree(shmdesc);
|
||||
free(shmdesc);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||
return(BadMatch);
|
||||
}
|
||||
|
||||
drawables = xcalloc(PanoramiXNumScreens, sizeof(DrawablePtr));
|
||||
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
|
||||
if(!drawables)
|
||||
return(BadAlloc);
|
||||
|
||||
@@ -681,7 +681,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
xfree(drawables);
|
||||
free(drawables);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -722,7 +722,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||
}
|
||||
}
|
||||
}
|
||||
xfree(drawables);
|
||||
free(drawables);
|
||||
|
||||
if (client->swapped) {
|
||||
int n;
|
||||
@@ -795,7 +795,7 @@ CreatePmap:
|
||||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||
|
||||
if(!(newPix = xalloc(sizeof(PanoramiXRes))))
|
||||
if(!(newPix = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newPix->type = XRT_PIXMAP;
|
||||
@@ -836,7 +836,7 @@ CreatePmap:
|
||||
(*pScreen->DestroyPixmap)(pMap);
|
||||
FreeResource(newPix->info[j].id, RT_NONE);
|
||||
}
|
||||
xfree(newPix);
|
||||
free(newPix);
|
||||
} else
|
||||
AddResource(stuff->pid, XRT_PIXMAP, newPix);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ ClientSleepUntil (ClientPtr client,
|
||||
SertafiedGeneration = serverGeneration;
|
||||
BlockHandlerRegistered = FALSE;
|
||||
}
|
||||
pRequest = xalloc (sizeof (SertafiedRec));
|
||||
pRequest = malloc(sizeof (SertafiedRec));
|
||||
if (!pRequest)
|
||||
return FALSE;
|
||||
pRequest->pClient = client;
|
||||
@@ -107,7 +107,7 @@ ClientSleepUntil (ClientPtr client,
|
||||
SertafiedWakeupHandler,
|
||||
(pointer) 0))
|
||||
{
|
||||
xfree (pRequest);
|
||||
free(pRequest);
|
||||
return FALSE;
|
||||
}
|
||||
BlockHandlerRegistered = TRUE;
|
||||
@@ -161,7 +161,7 @@ SertafiedDelete (pointer value, XID id)
|
||||
}
|
||||
if (pRequest->notifyFunc)
|
||||
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
|
||||
xfree (pRequest);
|
||||
free(pRequest);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
54
Xext/sync.c
54
Xext/sync.c
@@ -158,7 +158,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger)
|
||||
else
|
||||
pTrigger->pCounter->pTriglist = pCur->next;
|
||||
|
||||
xfree(pCur);
|
||||
free(pCur);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger)
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (!(pCur = xalloc(sizeof(SyncTriggerList))))
|
||||
if (!(pCur = malloc(sizeof(SyncTriggerList))))
|
||||
return BadAlloc;
|
||||
|
||||
pCur->pTrigger = pTrigger;
|
||||
@@ -417,7 +417,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
|
||||
|
||||
if (client->clientGone)
|
||||
return;
|
||||
pev = pEvents = xalloc(num_events * sizeof(xSyncCounterNotifyEvent));
|
||||
pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
|
||||
if (!pEvents)
|
||||
return;
|
||||
UpdateCurrentTime();
|
||||
@@ -438,7 +438,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
|
||||
}
|
||||
/* swapping will be taken care of by this */
|
||||
WriteEventsToClient(client, num_events, (xEvent *)pEvents);
|
||||
xfree(pEvents);
|
||||
free(pEvents);
|
||||
}
|
||||
|
||||
|
||||
@@ -545,7 +545,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
|
||||
|
||||
pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
|
||||
numwaits = pAwaitUnion->header.num_waitconditions;
|
||||
ppAwait = xalloc(numwaits * sizeof(SyncAwait *));
|
||||
ppAwait = malloc(numwaits * sizeof(SyncAwait *));
|
||||
if (!ppAwait)
|
||||
goto bail;
|
||||
|
||||
@@ -614,7 +614,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
|
||||
if (num_events)
|
||||
SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
|
||||
num_events);
|
||||
xfree(ppAwait);
|
||||
free(ppAwait);
|
||||
|
||||
bail:
|
||||
/* unblock the client */
|
||||
@@ -695,7 +695,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
|
||||
|
||||
/* add new client to pAlarm->pEventClients */
|
||||
|
||||
pClients = xalloc(sizeof(SyncAlarmClientList));
|
||||
pClients = malloc(sizeof(SyncAlarmClientList));
|
||||
if (!pClients)
|
||||
return BadAlloc;
|
||||
|
||||
@@ -706,7 +706,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
|
||||
pClients->delete_id = FakeClientID(client->index);
|
||||
if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
|
||||
{
|
||||
xfree(pClients);
|
||||
free(pClients);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@@ -824,12 +824,12 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
|
||||
{
|
||||
SyncCounter *pCounter;
|
||||
|
||||
if (!(pCounter = xalloc(sizeof(SyncCounter))))
|
||||
if (!(pCounter = malloc(sizeof(SyncCounter))))
|
||||
return NULL;
|
||||
|
||||
if (!AddResource(id, RTCounter, (pointer) pCounter))
|
||||
{
|
||||
xfree(pCounter);
|
||||
free(pCounter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ SyncCreateSystemCounter(
|
||||
{
|
||||
SyncCounter *pCounter;
|
||||
|
||||
SysCounterList = xrealloc(SysCounterList,
|
||||
SysCounterList = realloc(SysCounterList,
|
||||
(SyncNumSystemCounters+1)*sizeof(SyncCounter *));
|
||||
if (!SysCounterList)
|
||||
return NULL;
|
||||
@@ -886,7 +886,7 @@ SyncCreateSystemCounter(
|
||||
{
|
||||
SysCounterInfo *psci;
|
||||
|
||||
psci = xalloc(sizeof(SysCounterInfo));
|
||||
psci = malloc(sizeof(SysCounterInfo));
|
||||
if (!psci)
|
||||
{
|
||||
FreeResource(pCounter->id, RT_NONE);
|
||||
@@ -1008,7 +1008,7 @@ FreeAlarm(void *addr, XID id)
|
||||
|
||||
SyncDeleteTriggerFromCounter(&pAlarm->trigger);
|
||||
|
||||
xfree(pAlarm);
|
||||
free(pAlarm);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -1029,13 +1029,13 @@ FreeCounter(void *env, XID id)
|
||||
{
|
||||
(*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
|
||||
pnext = ptl->next;
|
||||
xfree(ptl); /* destroy the trigger list as we go */
|
||||
free(ptl); /* destroy the trigger list as we go */
|
||||
}
|
||||
if (IsSystemCounter(pCounter))
|
||||
{
|
||||
int i, found = 0;
|
||||
|
||||
xfree(pCounter->pSysCounterInfo);
|
||||
free(pCounter->pSysCounterInfo);
|
||||
|
||||
/* find the counter in the list of system counters and remove it */
|
||||
|
||||
@@ -1059,7 +1059,7 @@ FreeCounter(void *env, XID id)
|
||||
}
|
||||
SyncNumSystemCounters--;
|
||||
}
|
||||
xfree(pCounter);
|
||||
free(pCounter);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -1088,7 +1088,7 @@ FreeAwait(void *addr, XID id)
|
||||
if (pCounter && !pCounter->beingDestroyed)
|
||||
SyncDeleteTriggerFromCounter(&pAwait->trigger);
|
||||
}
|
||||
xfree(pAwaitUnion);
|
||||
free(pAwaitUnion);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -1109,7 +1109,7 @@ FreeAlarmClient(void *value, XID id)
|
||||
pPrev->next = pCur->next;
|
||||
else
|
||||
pAlarm->pEventClients = pCur->next;
|
||||
xfree(pCur);
|
||||
free(pCur);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
@@ -1174,7 +1174,7 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||
|
||||
if (len)
|
||||
{
|
||||
walklist = list = xalloc(len);
|
||||
walklist = list = malloc(len);
|
||||
if (!list)
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -1220,7 +1220,7 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||
if (len)
|
||||
{
|
||||
WriteToClient(client, len, (char *) list);
|
||||
xfree(list);
|
||||
free(list);
|
||||
}
|
||||
|
||||
return client->noClientException;
|
||||
@@ -1448,7 +1448,7 @@ ProcSyncAwait(ClientPtr client)
|
||||
/* all the memory for the entire await list is allocated
|
||||
* here in one chunk
|
||||
*/
|
||||
pAwaitUnion = xalloc((items+1) * sizeof(SyncAwaitUnion));
|
||||
pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion));
|
||||
if (!pAwaitUnion)
|
||||
return BadAlloc;
|
||||
|
||||
@@ -1457,7 +1457,7 @@ ProcSyncAwait(ClientPtr client)
|
||||
pAwaitUnion->header.delete_id = FakeClientID(client->index);
|
||||
if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
|
||||
{
|
||||
xfree(pAwaitUnion);
|
||||
free(pAwaitUnion);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@@ -1595,7 +1595,7 @@ ProcSyncCreateAlarm(ClientPtr client)
|
||||
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
|
||||
return BadLength;
|
||||
|
||||
if (!(pAlarm = xalloc(sizeof(SyncAlarm))))
|
||||
if (!(pAlarm = malloc(sizeof(SyncAlarm))))
|
||||
{
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ ProcSyncCreateAlarm(ClientPtr client)
|
||||
status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger);
|
||||
if (status != Success)
|
||||
{
|
||||
xfree(pAlarm);
|
||||
free(pAlarm);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1626,13 +1626,13 @@ ProcSyncCreateAlarm(ClientPtr client)
|
||||
(CARD32 *)&stuff[1]);
|
||||
if (status != Success)
|
||||
{
|
||||
xfree(pAlarm);
|
||||
free(pAlarm);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!AddResource(stuff->id, RTAlarm, pAlarm))
|
||||
{
|
||||
xfree(pAlarm);
|
||||
free(pAlarm);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@@ -2091,7 +2091,7 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
|
||||
static void
|
||||
SyncResetProc(ExtensionEntry *extEntry)
|
||||
{
|
||||
xfree(SysCounterList);
|
||||
free(SysCounterList);
|
||||
SysCounterList = NULL;
|
||||
RTCounter = 0;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ XaceCensorImage(
|
||||
|
||||
/* convert region to list-of-rectangles for PolyFillRect */
|
||||
|
||||
pRects = xalloc(nRects * sizeof(xRectangle));
|
||||
pRects = malloc(nRects * sizeof(xRectangle));
|
||||
if (!pRects)
|
||||
{
|
||||
failed = TRUE;
|
||||
@@ -326,7 +326,7 @@ XaceCensorImage(
|
||||
*/
|
||||
bzero(pBuf, (int)(widthBytesLine * h));
|
||||
}
|
||||
if (pRects) xfree(pRects);
|
||||
if (pRects) free(pRects);
|
||||
if (pScratchGC) FreeScratchGC(pScratchGC);
|
||||
if (pPix) FreeScratchPixmapHeader(pPix);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||
if (stuff->count > UINT32_MAX / sizeof(XID))
|
||||
return BadAlloc;
|
||||
|
||||
pids = (XID *)Xalloc(stuff->count * sizeof(XID));
|
||||
pids = (XID *)malloc(stuff->count * sizeof(XID));
|
||||
if (!pids)
|
||||
{
|
||||
return BadAlloc;
|
||||
@@ -144,7 +144,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||
}
|
||||
Xfree(pids);
|
||||
free(pids);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ shmalloc(
|
||||
if (size < 3500)
|
||||
return (ShmDescPtr) NULL;
|
||||
|
||||
pDesc = xalloc(sizeof(ShmDescRec));
|
||||
pDesc = malloc(sizeof(ShmDescRec));
|
||||
if (!pDesc)
|
||||
return (ShmDescPtr) NULL;
|
||||
|
||||
@@ -239,7 +239,7 @@ shmalloc(
|
||||
if (shmid == -1) {
|
||||
ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
|
||||
size, strerror(errno));
|
||||
xfree(pDesc);
|
||||
free(pDesc);
|
||||
return (ShmDescPtr) NULL;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ shmalloc(
|
||||
ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
|
||||
size, strerror(errno));
|
||||
shmctl(shmid, IPC_RMID, (void *) 0);
|
||||
xfree(pDesc);
|
||||
free(pDesc);
|
||||
return (ShmDescPtr) NULL;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ shmdealloc(
|
||||
|
||||
if (pDesc->next) pDesc->next->prev = pDesc->prev;
|
||||
*pDesc->prev = pDesc->next;
|
||||
xfree(pDesc);
|
||||
free(pDesc);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -464,7 +464,7 @@ ProcXF86BigfontQueryFont(
|
||||
shmid = pDesc->shmid;
|
||||
} else {
|
||||
#endif
|
||||
pCI = xalloc(nCharInfos * sizeof(xCharInfo));
|
||||
pCI = malloc(nCharInfos * sizeof(xCharInfo));
|
||||
if (!pCI)
|
||||
return BadAlloc;
|
||||
#ifdef HAS_SHM
|
||||
@@ -526,9 +526,9 @@ ProcXF86BigfontQueryFont(
|
||||
if (hashModulus > nCharInfos+1)
|
||||
hashModulus = nCharInfos+1;
|
||||
|
||||
tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
|
||||
tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
|
||||
if (!tmp) {
|
||||
if (!pDesc) xfree(pCI);
|
||||
if (!pDesc) free(pCI);
|
||||
return BadAlloc;
|
||||
}
|
||||
pIndex2UniqIndex = tmp;
|
||||
@@ -610,12 +610,12 @@ ProcXF86BigfontQueryFont(
|
||||
? nUniqCharInfos * sizeof(xCharInfo)
|
||||
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
|
||||
: 0);
|
||||
xXF86BigfontQueryFontReply* reply = xalloc(rlength);
|
||||
xXF86BigfontQueryFontReply* reply = malloc(rlength);
|
||||
char* p;
|
||||
if (!reply) {
|
||||
if (nCharInfos > 0) {
|
||||
if (shmid == -1) xfree(pIndex2UniqIndex);
|
||||
if (!pDesc) xfree(pCI);
|
||||
if (shmid == -1) free(pIndex2UniqIndex);
|
||||
if (!pDesc) free(pCI);
|
||||
}
|
||||
return BadAlloc;
|
||||
}
|
||||
@@ -693,10 +693,10 @@ ProcXF86BigfontQueryFont(
|
||||
}
|
||||
}
|
||||
WriteToClient(client, rlength, (char *)reply);
|
||||
xfree(reply);
|
||||
free(reply);
|
||||
if (nCharInfos > 0) {
|
||||
if (shmid == -1) xfree(pIndex2UniqIndex);
|
||||
if (!pDesc) xfree(pCI);
|
||||
if (shmid == -1) free(pIndex2UniqIndex);
|
||||
if (!pDesc) free(pCI);
|
||||
}
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ ProcXResQueryClients (ClientPtr client)
|
||||
|
||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||
|
||||
current_clients = xalloc(currentMaxClients * sizeof(int));
|
||||
current_clients = malloc(currentMaxClients * sizeof(int));
|
||||
|
||||
num_clients = 0;
|
||||
for(i = 0; i < currentMaxClients; i++) {
|
||||
@@ -101,7 +101,7 @@ ProcXResQueryClients (ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
xfree(current_clients);
|
||||
free(current_clients);
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ ProcXResQueryClientResources (ClientPtr client)
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
counts = xcalloc(lastResourceType + 1, sizeof(int));
|
||||
counts = calloc(lastResourceType + 1, sizeof(int));
|
||||
|
||||
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
|
||||
|
||||
@@ -182,7 +182,7 @@ ProcXResQueryClientResources (ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
xfree(counts);
|
||||
free(counts);
|
||||
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ typedef struct {
|
||||
static security_context_t
|
||||
SELinuxCopyContext(char *ptr, unsigned len)
|
||||
{
|
||||
security_context_t copy = xalloc(len + 1);
|
||||
security_context_t copy = malloc(len + 1);
|
||||
if (!copy)
|
||||
return NULL;
|
||||
strncpy(copy, ptr, len);
|
||||
@@ -141,7 +141,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
|
||||
rc = BadValue;
|
||||
}
|
||||
|
||||
xfree(ctx);
|
||||
free(ctx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
|
||||
|
||||
rc = Success;
|
||||
out:
|
||||
xfree(ctx);
|
||||
free(ctx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ SELinuxFreeItems(SELinuxListItemRec *items, int count)
|
||||
freecon(items[k].octx);
|
||||
freecon(items[k].dctx);
|
||||
}
|
||||
xfree(items);
|
||||
free(items);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -345,7 +345,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
|
||||
SELinuxListItemsReply rep;
|
||||
CARD32 *buf;
|
||||
|
||||
buf = xcalloc(size, sizeof(CARD32));
|
||||
buf = calloc(size, sizeof(CARD32));
|
||||
if (size && !buf) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
@@ -391,7 +391,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
|
||||
|
||||
/* Free stuff and return */
|
||||
rc = client->noClientException;
|
||||
xfree(buf);
|
||||
free(buf);
|
||||
out:
|
||||
SELinuxFreeItems(items, count);
|
||||
return rc;
|
||||
@@ -417,7 +417,7 @@ ProcSELinuxListProperties(ClientPtr client)
|
||||
count = 0;
|
||||
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
|
||||
count++;
|
||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||
items = calloc(count, sizeof(SELinuxListItemRec));
|
||||
if (count && !items)
|
||||
return BadAlloc;
|
||||
|
||||
@@ -451,7 +451,7 @@ ProcSELinuxListSelections(ClientPtr client)
|
||||
count = 0;
|
||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
count++;
|
||||
items = xcalloc(count, sizeof(SELinuxListItemRec));
|
||||
items = calloc(count, sizeof(SELinuxListItemRec));
|
||||
if (count && !items)
|
||||
return BadAlloc;
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ SELinuxLabelClient(ClientPtr client)
|
||||
if (bytes <= 0)
|
||||
goto finish;
|
||||
|
||||
subj->command = xalloc(bytes);
|
||||
subj->command = malloc(bytes);
|
||||
if (!subj->command)
|
||||
goto finish;
|
||||
|
||||
@@ -830,7 +830,7 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||
PrivateCallbackRec *rec = calldata;
|
||||
SELinuxSubjectRec *subj = *rec->value;
|
||||
|
||||
xfree(subj->command);
|
||||
free(subj->command);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -62,7 +62,7 @@ SELinuxArraySet(SELinuxArrayRec *rec, unsigned key, void *val)
|
||||
{
|
||||
if (key >= rec->size) {
|
||||
/* Need to increase size of array */
|
||||
rec->array = xrealloc(rec->array, (key + 1) * sizeof(val));
|
||||
rec->array = realloc(rec->array, (key + 1) * sizeof(val));
|
||||
if (!rec->array)
|
||||
return FALSE;
|
||||
memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
|
||||
@@ -79,10 +79,10 @@ SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
|
||||
if (free_elements) {
|
||||
unsigned i = rec->size;
|
||||
while (i)
|
||||
xfree(rec->array[--i]);
|
||||
free(rec->array[--i]);
|
||||
}
|
||||
|
||||
xfree(rec->array);
|
||||
free(rec->array);
|
||||
rec->size = 0;
|
||||
rec->array = NULL;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
|
||||
|
||||
rec = SELinuxArrayGet(&arr_atoms, atom);
|
||||
if (!rec) {
|
||||
rec = xcalloc(1, sizeof(SELinuxAtomRec));
|
||||
rec = calloc(1, sizeof(SELinuxAtomRec));
|
||||
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
|
||||
{
|
||||
int retval;
|
||||
int len = strlen(name);
|
||||
char *xtestname = xcalloc(len + 7, 1 );
|
||||
char *xtestname = calloc(len + 7, 1 );
|
||||
char dummy = 1;
|
||||
|
||||
strncpy( xtestname, name, len);
|
||||
@@ -660,7 +660,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
|
||||
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
|
||||
}
|
||||
|
||||
xfree( xtestname );
|
||||
free( xtestname );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1157,7 +1157,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
||||
|
||||
num_planes = pImage->num_planes;
|
||||
|
||||
if(!(offsets = xalloc(num_planes << 3)))
|
||||
if(!(offsets = malloc(num_planes << 3)))
|
||||
return BadAlloc;
|
||||
pitches = offsets + num_planes;
|
||||
|
||||
@@ -1180,7 +1180,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
||||
SwapLongs((CARD32*)offsets, planeLength);
|
||||
WriteToClient(client, planeLength << 2, (char*)offsets);
|
||||
|
||||
xfree(offsets);
|
||||
free(offsets);
|
||||
|
||||
return Success;
|
||||
}
|
||||
@@ -1924,7 +1924,7 @@ void XineramifyXv(void)
|
||||
|
||||
/* now create a resource for each port */
|
||||
for(j = 0; j < refAdapt->nPorts; j++) {
|
||||
PanoramiXRes *port = xalloc(sizeof(PanoramiXRes));
|
||||
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
|
||||
if(!port)
|
||||
break;
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ XvScreenInit(ScreenPtr pScreen)
|
||||
|
||||
/* ALLOCATE SCREEN PRIVATE RECORD */
|
||||
|
||||
pxvs = xalloc (sizeof (XvScreenRec));
|
||||
pxvs = malloc(sizeof (XvScreenRec));
|
||||
if (!pxvs)
|
||||
{
|
||||
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
||||
@@ -314,7 +314,7 @@ XvCloseScreen(
|
||||
|
||||
(* pxvs->ddCloseScreen)(ii, pScreen);
|
||||
|
||||
xfree(pxvs);
|
||||
free(pxvs);
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
|
||||
|
||||
@@ -509,7 +509,7 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
|
||||
{
|
||||
npn = cpn->next;
|
||||
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
|
||||
xfree(cpn);
|
||||
free(cpn);
|
||||
cpn = npn;
|
||||
}
|
||||
return Success;
|
||||
@@ -928,12 +928,12 @@ XvdiSelectVideoNotify(
|
||||
|
||||
if (!pn)
|
||||
{
|
||||
if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = NULL;
|
||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
|
||||
{
|
||||
xfree(tpn);
|
||||
free(tpn);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
@@ -966,7 +966,7 @@ XvdiSelectVideoNotify(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pn->next;
|
||||
pn->next = tpn;
|
||||
@@ -1024,7 +1024,7 @@ XvdiSelectPortNotify(
|
||||
|
||||
if (!tpn)
|
||||
{
|
||||
if (!(tpn = xalloc(sizeof(XvPortNotifyRec))))
|
||||
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pPort->pNotify;
|
||||
pPort->pNotify = tpn;
|
||||
|
||||
28
Xext/xvmc.c
28
Xext/xvmc.c
@@ -71,7 +71,7 @@ XvMCDestroyContextRes(pointer data, XID id)
|
||||
if(!pContext->refcnt) {
|
||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
|
||||
xfree(pContext);
|
||||
free(pContext);
|
||||
}
|
||||
|
||||
return Success;
|
||||
@@ -85,7 +85,7 @@ XvMCDestroySurfaceRes(pointer data, XID id)
|
||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface);
|
||||
xfree(pSurface);
|
||||
free(pSurface);
|
||||
|
||||
XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
|
||||
|
||||
@@ -101,7 +101,7 @@ XvMCDestroySubpictureRes(pointer data, XID id)
|
||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict);
|
||||
xfree(pSubpict);
|
||||
free(pSubpict);
|
||||
|
||||
XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
|
||||
|
||||
@@ -226,7 +226,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||
(stuff->height > surface->max_height))
|
||||
return BadValue;
|
||||
|
||||
if(!(pContext = xalloc(sizeof(XvMCContextRec)))) {
|
||||
if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||
result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
|
||||
|
||||
if(result != Success) {
|
||||
xfree(pContext);
|
||||
free(pContext);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||
AddResource(pContext->context_id, XvMCRTContext, pContext);
|
||||
|
||||
if(data)
|
||||
xfree(data);
|
||||
free(data);
|
||||
|
||||
return Success;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||
|
||||
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
if(!(pSurface = xalloc(sizeof(XvMCSurfaceRec))))
|
||||
if(!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pSurface->surface_id = stuff->surface_id;
|
||||
@@ -314,7 +314,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||
pSurface, &dwords, &data);
|
||||
|
||||
if(result != Success) {
|
||||
xfree(pSurface);
|
||||
free(pSurface);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
|
||||
|
||||
if(data)
|
||||
xfree(data);
|
||||
free(data);
|
||||
|
||||
pContext->refcnt++;
|
||||
|
||||
@@ -404,7 +404,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||
(stuff->height > surface->subpicture_max_height))
|
||||
return BadValue;
|
||||
|
||||
if(!(pSubpicture = xalloc(sizeof(XvMCSubpictureRec))))
|
||||
if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pSubpicture->subpicture_id = stuff->subpicture_id;
|
||||
@@ -423,7 +423,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||
pSubpicture, &dwords, &data);
|
||||
|
||||
if(result != Success) {
|
||||
xfree(pSubpicture);
|
||||
free(pSubpicture);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
|
||||
|
||||
if(data)
|
||||
xfree(data);
|
||||
free(data);
|
||||
|
||||
pContext->refcnt++;
|
||||
|
||||
@@ -704,7 +704,7 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
|
||||
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
|
||||
xfree(pScreenPriv);
|
||||
free(pScreenPriv);
|
||||
|
||||
return (*pScreen->CloseScreen)(i, pScreen);
|
||||
}
|
||||
@@ -717,7 +717,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
||||
|
||||
XvMCScreenKey = &XvMCScreenKeyIndex;
|
||||
|
||||
if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec))))
|
||||
if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
|
||||
return BadAlloc;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
|
||||
|
||||
Reference in New Issue
Block a user