Compare commits
26 Commits
master
...
submit/rep
Author | SHA1 | Date | |
---|---|---|---|
|
b5f508dd52 | ||
|
3ab983fcc9 | ||
|
216bcc0ff9 | ||
|
2ad73189b4 | ||
|
419076ae25 | ||
|
55032e9d19 | ||
|
5a6a6754b8 | ||
|
74b2b97be8 | ||
|
aa43529bc2 | ||
|
a87fa30ed5 | ||
|
67fc0c527c | ||
|
d827f6ab9a | ||
|
9ebc53d776 | ||
|
bde5962da4 | ||
|
6b451da19c | ||
|
46a32f327e | ||
|
a4fb34d754 | ||
|
9d3dcea6ae | ||
|
0111bd0d06 | ||
|
ccf25f25c0 | ||
|
fb3bbd5ec1 | ||
|
9acd7c0629 | ||
|
1dd6363162 | ||
|
85453198b6 | ||
|
c4740b57e6 | ||
|
76c98cb195 |
|
@ -145,10 +145,9 @@ ProcDPMSSelectInput(register ClientPtr client)
|
|||
}
|
||||
|
||||
/* build the entry */
|
||||
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
|
||||
pNewEvent = calloc(1, sizeof(DPMSEventRec));
|
||||
if (!pNewEvent)
|
||||
return BadAlloc;
|
||||
pNewEvent->next = 0;
|
||||
pNewEvent->client = client;
|
||||
pNewEvent->mask = stuff->eventMask;
|
||||
/*
|
||||
|
@ -164,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
|
|||
* of clients selecting input
|
||||
*/
|
||||
if (i != Success || !pHead) {
|
||||
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
|
||||
pHead = calloc(1, sizeof(DPMSEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
|
||||
FreeResource(clientResource, X11_RESTYPE_NONE);
|
||||
|
|
|
@ -39,7 +39,7 @@ ht_create(int keySize,
|
|||
{
|
||||
int c;
|
||||
int numBuckets;
|
||||
HashTable ht = malloc(sizeof(struct HashTableRec));
|
||||
HashTable ht = calloc(1, sizeof(struct HashTableRec));
|
||||
|
||||
if (!ht) {
|
||||
return NULL;
|
||||
|
@ -127,7 +127,7 @@ ht_add(HashTable ht, const void *key)
|
|||
if (!elem) {
|
||||
goto outOfMemory;
|
||||
}
|
||||
elem->key = malloc(ht->keySize);
|
||||
elem->key = calloc(1, ht->keySize);
|
||||
if (!elem->key) {
|
||||
goto outOfMemory;
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ XineramaRegisterConnectionBlockCallback(void (*func) (void))
|
|||
{
|
||||
XineramaConnectionCallbackList *newlist;
|
||||
|
||||
if (!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
|
||||
if (!(newlist = calloc(1, sizeof(XineramaConnectionCallbackList))))
|
||||
return FALSE;
|
||||
|
||||
newlist->next = ConnectionCallbackList;
|
||||
|
@ -439,7 +439,6 @@ PanoramiXExtensionInit(void)
|
|||
Bool success = FALSE;
|
||||
ExtensionEntry *extEntry;
|
||||
ScreenPtr pScreen = screenInfo.screens[0];
|
||||
PanoramiXScreenPtr pScreenPriv;
|
||||
|
||||
if (noPanoramiXExtension)
|
||||
return;
|
||||
|
@ -476,7 +475,7 @@ PanoramiXExtensionInit(void)
|
|||
|
||||
FOR_NSCREENS(i) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
|
||||
PanoramiXScreenPtr pScreenPriv = calloc(1, sizeof(PanoramiXScreenRec));
|
||||
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
|
||||
pScreenPriv);
|
||||
if (!pScreenPriv) {
|
||||
|
@ -806,7 +805,6 @@ extern void
|
|||
PanoramiXConsolidate(void)
|
||||
{
|
||||
int i;
|
||||
PanoramiXRes *root, *defmap, *saver;
|
||||
ScreenPtr pScreen = screenInfo.screens[0];
|
||||
DepthPtr pDepth = pScreen->allowedDepths;
|
||||
VisualPtr pVisual = pScreen->visuals;
|
||||
|
@ -820,11 +818,11 @@ PanoramiXConsolidate(void)
|
|||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
PanoramiXMaybeAddVisual(pVisual++);
|
||||
|
||||
root = malloc(sizeof(PanoramiXRes));
|
||||
PanoramiXRes *root = calloc(1, sizeof(PanoramiXRes));
|
||||
root->type = XRT_WINDOW;
|
||||
defmap = malloc(sizeof(PanoramiXRes));
|
||||
PanoramiXRes *defmap = calloc(1, sizeof(PanoramiXRes));
|
||||
defmap->type = XRT_COLORMAP;
|
||||
saver = malloc(sizeof(PanoramiXRes));
|
||||
PanoramiXRes *saver = calloc(1, sizeof(PanoramiXRes));
|
||||
saver->type = XRT_WINDOW;
|
||||
|
||||
FOR_NSCREENS(i) {
|
||||
|
|
|
@ -117,7 +117,7 @@ PanoramiXCreateWindow(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(newWin = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newWin = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newWin->type = XRT_WINDOW;
|
||||
|
@ -694,7 +694,7 @@ PanoramiXCreatePixmap(ClientPtr client)
|
|||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if (!(newPix = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newPix->type = XRT_PIXMAP;
|
||||
|
@ -801,7 +801,7 @@ PanoramiXCreateGC(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(newGC = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newGC = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newGC->type = XRT_GC;
|
||||
|
@ -2289,7 +2289,7 @@ PanoramiXCreateColormap(ClientPtr client)
|
|||
if (result != Success)
|
||||
return result;
|
||||
|
||||
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newCmap->type = XRT_COLORMAP;
|
||||
|
@ -2361,7 +2361,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
|
|||
if (result != Success)
|
||||
return result;
|
||||
|
||||
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newCmap->type = XRT_COLORMAP;
|
||||
|
|
|
@ -1217,7 +1217,7 @@ ProcScreenSaverSuspend(ClientPtr client)
|
|||
* to the record, so the screensaver will be re-enabled and the record freed
|
||||
* if the client disconnects without reenabling it first.
|
||||
*/
|
||||
this = malloc(sizeof(ScreenSaverSuspensionRec));
|
||||
this = calloc(1, sizeof(ScreenSaverSuspensionRec));
|
||||
|
||||
if (!this)
|
||||
return BadAlloc;
|
||||
|
|
|
@ -385,7 +385,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
|
|||
}
|
||||
}
|
||||
|
||||
pEventClient = malloc(sizeof(OtherClients));
|
||||
pEventClient = calloc(1, sizeof(OtherClients));
|
||||
if (!pEventClient)
|
||||
return BadAlloc;
|
||||
pEventClient->mask = mask;
|
||||
|
@ -406,7 +406,6 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
|
|||
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||
int len; /* request length in CARD32s */
|
||||
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
|
||||
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
|
||||
int err; /* error to return from this function */
|
||||
XID authId; /* authorization ID assigned by os layer */
|
||||
xSecurityGenerateAuthorizationReply rep; /* reply struct */
|
||||
|
@ -493,8 +492,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
|
|||
stuff->nbytesAuthData, protodata,
|
||||
&authdata_len, &pAuthdata);
|
||||
if ((XID) ~0L == authId) {
|
||||
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
|
||||
goto bailout;
|
||||
return SecurityErrorBase + XSecurityBadAuthorizationProtocol;
|
||||
}
|
||||
|
||||
/* now that we've added the auth, remember to remove it if we have to
|
||||
|
@ -504,7 +502,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
|
|||
|
||||
/* associate additional information with this auth ID */
|
||||
|
||||
pAuth = malloc(sizeof(SecurityAuthorizationRec));
|
||||
SecurityAuthorizationPtr pAuth = calloc(1, sizeof(SecurityAuthorizationRec));
|
||||
if (!pAuth) {
|
||||
err = BadAlloc;
|
||||
goto bailout;
|
||||
|
|
|
@ -752,7 +752,7 @@ ProcShapeSelectInput(ClientPtr client)
|
|||
}
|
||||
|
||||
/* build the entry */
|
||||
pNewShapeEvent = malloc(sizeof(ShapeEventRec));
|
||||
pNewShapeEvent = calloc(1, sizeof(ShapeEventRec));
|
||||
if (!pNewShapeEvent)
|
||||
return BadAlloc;
|
||||
pNewShapeEvent->next = 0;
|
||||
|
@ -773,7 +773,7 @@ ProcShapeSelectInput(ClientPtr client)
|
|||
* done through the resource database.
|
||||
*/
|
||||
if (!pHead) {
|
||||
pHead = malloc(sizeof(ShapeEventPtr));
|
||||
pHead = calloc(1, sizeof(ShapeEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource(pWin->drawable.id, ShapeEventType,
|
||||
(void *) pHead)) {
|
||||
|
@ -962,7 +962,7 @@ ProcShapeGetRectangles(ClientPtr client)
|
|||
}
|
||||
if (!region) {
|
||||
nrects = 1;
|
||||
rects = malloc(sizeof(xRectangle));
|
||||
rects = calloc(1, sizeof(xRectangle));
|
||||
if (!rects)
|
||||
return BadAlloc;
|
||||
switch (stuff->kind) {
|
||||
|
|
11
Xext/shm.c
11
Xext/shm.c
|
@ -395,7 +395,7 @@ ProcShmAttach(ClientPtr client)
|
|||
shmdesc->refcnt++;
|
||||
}
|
||||
else {
|
||||
shmdesc = malloc(sizeof(ShmDescRec));
|
||||
shmdesc = calloc(1, sizeof(ShmDescRec));
|
||||
if (!shmdesc)
|
||||
return BadAlloc;
|
||||
#ifdef SHM_FD_PASSING
|
||||
|
@ -781,7 +781,6 @@ static int
|
|||
ProcPanoramiXShmGetImage(ClientPtr client)
|
||||
{
|
||||
PanoramiXRes *draw;
|
||||
DrawablePtr *drawables;
|
||||
DrawablePtr pDraw;
|
||||
xShmGetImageReply xgi;
|
||||
ShmDescPtr shmdesc;
|
||||
|
@ -856,7 +855,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||
|
||||
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
|
||||
DrawablePtr *drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
|
||||
if (!drawables)
|
||||
return BadAlloc;
|
||||
|
||||
|
@ -976,7 +975,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||
|
||||
if (!(newPix = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newPix->type = XRT_PIXMAP;
|
||||
|
@ -1169,7 +1168,7 @@ ProcShmAttachFd(ClientPtr client)
|
|||
return BadMatch;
|
||||
}
|
||||
|
||||
shmdesc = malloc(sizeof(ShmDescRec));
|
||||
shmdesc = calloc(1, sizeof(ShmDescRec));
|
||||
if (!shmdesc) {
|
||||
close(fd);
|
||||
return BadAlloc;
|
||||
|
@ -1286,7 +1285,7 @@ ProcShmCreateSegment(ClientPtr client)
|
|||
close(fd);
|
||||
return BadAlloc;
|
||||
}
|
||||
shmdesc = malloc(sizeof(ShmDescRec));
|
||||
shmdesc = calloc(1, sizeof(ShmDescRec));
|
||||
if (!shmdesc) {
|
||||
close(fd);
|
||||
return BadAlloc;
|
||||
|
|
|
@ -72,7 +72,7 @@ ClientSleepUntil(ClientPtr client,
|
|||
TimeStamp *revive,
|
||||
void (*notifyFunc) (ClientPtr, void *), void *closure)
|
||||
{
|
||||
SertafiedPtr pRequest, pReq, pPrev;
|
||||
SertafiedPtr pReq, pPrev;
|
||||
|
||||
if (SertafiedGeneration != serverGeneration) {
|
||||
SertafiedResType = CreateNewResourceType(SertafiedDelete,
|
||||
|
@ -82,7 +82,8 @@ ClientSleepUntil(ClientPtr client,
|
|||
SertafiedGeneration = serverGeneration;
|
||||
BlockHandlerRegistered = FALSE;
|
||||
}
|
||||
pRequest = malloc(sizeof(SertafiedRec));
|
||||
|
||||
SertafiedPtr pRequest = calloc(1, sizeof(SertafiedRec));
|
||||
if (!pRequest)
|
||||
return FALSE;
|
||||
pRequest->pClient = client;
|
||||
|
|
19
Xext/sync.c
19
Xext/sync.c
|
@ -764,8 +764,6 @@ SyncChangeCounter(SyncCounter * pCounter, int64_t newval)
|
|||
static Bool
|
||||
SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
|
||||
{
|
||||
SyncAlarmClientList *pClients;
|
||||
|
||||
if (client == pAlarm->client) { /* alarm owner */
|
||||
pAlarm->events = wantevents;
|
||||
return Success;
|
||||
|
@ -773,7 +771,8 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
|
|||
|
||||
/* see if the client is already on the list (has events selected) */
|
||||
|
||||
for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) {
|
||||
for (SyncAlarmClientList *pClients = pClients = pAlarm->pEventClients;
|
||||
pClients; pClients = pClients->next) {
|
||||
if (pClients->client == client) {
|
||||
/* client's presence on the list indicates desire for
|
||||
* events. If the client doesn't want events, remove it
|
||||
|
@ -799,7 +798,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
|
|||
|
||||
/* add new client to pAlarm->pEventClients */
|
||||
|
||||
pClients = malloc(sizeof(SyncAlarmClientList));
|
||||
SyncAlarmClientList *pClients = calloc(1, sizeof(SyncAlarmClientList));
|
||||
if (!pClients)
|
||||
return BadAlloc;
|
||||
|
||||
|
@ -934,7 +933,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
|
|||
|
||||
switch (type) {
|
||||
case SYNC_COUNTER:
|
||||
pSync = malloc(sizeof(SyncCounter));
|
||||
pSync = calloc(1, sizeof(SyncCounter));
|
||||
resType = RTCounter;
|
||||
break;
|
||||
case SYNC_FENCE:
|
||||
|
@ -1030,9 +1029,7 @@ SyncCreateSystemCounter(const char *name,
|
|||
SyncCounter *pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
|
||||
|
||||
if (pCounter) {
|
||||
SysCounterInfo *psci;
|
||||
|
||||
psci = malloc(sizeof(SysCounterInfo));
|
||||
SysCounterInfo *psci = calloc(1, sizeof(SysCounterInfo));
|
||||
if (!psci) {
|
||||
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
|
||||
return pCounter;
|
||||
|
@ -1311,7 +1308,7 @@ ProcSyncListSystemCounters(ClientPtr client)
|
|||
}
|
||||
|
||||
if (len) {
|
||||
walklist = list = malloc(len);
|
||||
walklist = list = calloc(1, len);
|
||||
if (!list)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
@ -1739,7 +1736,7 @@ ProcSyncCreateAlarm(ClientPtr client)
|
|||
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue | XSyncCADelta))))
|
||||
return BadLength;
|
||||
|
||||
if (!(pAlarm = malloc(sizeof(SyncAlarm)))) {
|
||||
if (!(pAlarm = calloc(1, sizeof(SyncAlarm)))) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
@ -2824,7 +2821,7 @@ init_system_idle_counter(const char *name, int deviceid)
|
|||
IdleTimeBracketValues);
|
||||
|
||||
if (idle_time_counter != NULL) {
|
||||
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
|
||||
IdleCounterPriv *priv = calloc(1, sizeof(IdleCounterPriv));
|
||||
|
||||
priv->value_less = priv->value_greater = NULL;
|
||||
priv->deviceid = deviceid;
|
||||
|
|
|
@ -75,9 +75,7 @@ typedef struct {
|
|||
static DisplayModePtr
|
||||
VidModeCreateMode(void)
|
||||
{
|
||||
DisplayModePtr mode;
|
||||
|
||||
mode = malloc(sizeof(DisplayModeRec));
|
||||
DisplayModePtr mode = calloc(1, sizeof(DisplayModeRec));
|
||||
if (mode != NULL) {
|
||||
mode->name = "";
|
||||
mode->VScan = 1; /* divides refresh rate. default = 1 */
|
||||
|
@ -1630,7 +1628,7 @@ ProcVidModeSetClientVersion(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
|
||||
|
||||
if ((pPriv = VM_GETPRIV(client)) == NULL) {
|
||||
pPriv = malloc(sizeof(VidModePrivRec));
|
||||
pPriv = calloc(1, sizeof(VidModePrivRec));
|
||||
if (!pPriv)
|
||||
return BadAlloc;
|
||||
VM_SETPRIV(client, pPriv);
|
||||
|
|
|
@ -204,7 +204,6 @@ XaceCensorImage(ClientPtr client,
|
|||
if (nRects > 0) { /* we have something to censor */
|
||||
GCPtr pScratchGC = NULL;
|
||||
PixmapPtr pPix = NULL;
|
||||
xRectangle *pRects = NULL;
|
||||
Bool failed = FALSE;
|
||||
int depth = 1;
|
||||
int bitsPerPixel = 1;
|
||||
|
@ -213,7 +212,7 @@ XaceCensorImage(ClientPtr client,
|
|||
|
||||
/* convert region to list-of-rectangles for PolyFillRect */
|
||||
|
||||
pRects = malloc(nRects * sizeof(xRectangle));
|
||||
xRectangle *pRects = calloc(1, nRects * sizeof(xRectangle));
|
||||
if (!pRects) {
|
||||
failed = TRUE;
|
||||
goto failSafe;
|
||||
|
|
|
@ -147,7 +147,6 @@ static ShmDescPtr ShmList = (ShmDescPtr) NULL;
|
|||
static ShmDescPtr
|
||||
shmalloc(unsigned int size)
|
||||
{
|
||||
ShmDescPtr pDesc;
|
||||
int shmid;
|
||||
char *addr;
|
||||
|
||||
|
@ -165,7 +164,7 @@ shmalloc(unsigned int size)
|
|||
if (size < 3500)
|
||||
return (ShmDescPtr) NULL;
|
||||
|
||||
pDesc = malloc(sizeof(ShmDescRec));
|
||||
ShmDescPtr pDesc = calloc(1, sizeof(ShmDescRec));
|
||||
if (!pDesc)
|
||||
return (ShmDescPtr) NULL;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef struct {
|
|||
static void *
|
||||
AddFragment(struct xorg_list *frags, int bytes)
|
||||
{
|
||||
FragmentList *f = malloc(sizeof(FragmentList) + bytes);
|
||||
FragmentList *f = calloc(1, sizeof(FragmentList) + bytes);
|
||||
if (!f) {
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
|
@ -55,7 +55,7 @@ int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
|
|||
static char *
|
||||
SELinuxCopyContext(char *ptr, unsigned len)
|
||||
{
|
||||
char *copy = malloc(len + 1);
|
||||
char *copy = calloc(1, len + 1);
|
||||
|
||||
if (!copy)
|
||||
return NULL;
|
||||
|
|
|
@ -992,7 +992,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
|||
|
||||
num_planes = pImage->num_planes;
|
||||
|
||||
if (!(offsets = malloc(num_planes << 3)))
|
||||
if (!(offsets = calloc(1, num_planes << 3)))
|
||||
return BadAlloc;
|
||||
pitches = offsets + num_planes;
|
||||
|
||||
|
@ -1745,7 +1745,7 @@ XineramifyXv(void)
|
|||
|
||||
/* now create a resource for each port */
|
||||
for (j = 0; j < refAdapt->nPorts; j++) {
|
||||
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
|
||||
PanoramiXRes *port = calloc(1, sizeof(PanoramiXRes));
|
||||
|
||||
if (!port)
|
||||
break;
|
||||
|
|
|
@ -260,8 +260,6 @@ CreateResourceTypes(void)
|
|||
int
|
||||
XvScreenInit(ScreenPtr pScreen)
|
||||
{
|
||||
XvScreenPtr pxvs;
|
||||
|
||||
if (XvScreenGeneration != serverGeneration) {
|
||||
if (!CreateResourceTypes()) {
|
||||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||
|
@ -282,7 +280,7 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
|
||||
/* ALLOCATE SCREEN PRIVATE RECORD */
|
||||
|
||||
pxvs = malloc(sizeof(XvScreenRec));
|
||||
XvScreenPtr pxvs = calloc(1, sizeof(XvScreenRec));
|
||||
if (!pxvs) {
|
||||
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
||||
return BadAlloc;
|
||||
|
@ -809,7 +807,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
|
||||
|
||||
if (!pn) {
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = NULL;
|
||||
tpn->client = NULL;
|
||||
|
@ -845,7 +843,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
tpn = fpn;
|
||||
}
|
||||
else {
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pn->next;
|
||||
pn->next = tpn;
|
||||
|
@ -899,7 +897,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
|
|||
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
|
||||
|
||||
if (!tpn) {
|
||||
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
|
||||
if (!(tpn = calloc(1, sizeof(XvPortNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pPort->pNotify;
|
||||
pPort->pNotify = tpn;
|
||||
|
|
|
@ -233,7 +233,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
(stuff->height > surface->max_height))
|
||||
return BadValue;
|
||||
|
||||
if (!(pContext = malloc(sizeof(XvMCContextRec)))) {
|
||||
if (!(pContext = calloc(1, sizeof(XvMCContextRec)))) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
|
||||
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
if (!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
|
||||
if (!(pSurface = calloc(1, sizeof(XvMCSurfaceRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pSurface->surface_id = stuff->surface_id;
|
||||
|
@ -428,7 +428,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
(stuff->height > surface->subpicture_max_height))
|
||||
return BadValue;
|
||||
|
||||
if (!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
|
||||
if (!(pSubpicture = calloc(1, sizeof(XvMCSubpictureRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pSubpicture->subpicture_id = stuff->subpicture_id;
|
||||
|
@ -753,7 +753,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
|||
if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||
return BadAlloc;
|
||||
|
||||
if (!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
|
||||
if (!(pScreenPriv = calloc(1, sizeof(XvMCScreenRec))))
|
||||
return BadAlloc;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
|
||||
|
|
|
@ -2330,12 +2330,10 @@ DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *e
|
|||
int
|
||||
InitProximityClassDeviceStruct(DeviceIntPtr dev)
|
||||
{
|
||||
ProximityClassPtr proxc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
BUG_RETURN_VAL(dev->proximity != NULL, FALSE);
|
||||
|
||||
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
|
||||
ProximityClassPtr proxc = calloc(1, sizeof(ProximityClassRec));
|
||||
if (!proxc)
|
||||
return FALSE;
|
||||
proxc->sourceid = dev->id;
|
||||
|
|
|
@ -168,7 +168,7 @@ int
|
|||
ProcXGetDeviceControl(ClientPtr client)
|
||||
{
|
||||
int rc, total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
char *savbuf;
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceControlReply rep;
|
||||
|
||||
|
@ -206,7 +206,7 @@ ProcXGetDeviceControl(ClientPtr client)
|
|||
return BadValue;
|
||||
}
|
||||
|
||||
buf = (char *) malloc(total_length);
|
||||
char *buf = calloc(1, total_length);
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
savbuf = buf;
|
||||
|
|
|
@ -261,7 +261,7 @@ int
|
|||
ProcXGetFeedbackControl(ClientPtr client)
|
||||
{
|
||||
int rc, total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
char *savbuf;
|
||||
DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
PtrFeedbackPtr p;
|
||||
|
@ -315,7 +315,7 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
if (total_length == 0)
|
||||
return BadMatch;
|
||||
|
||||
buf = (char *) malloc(total_length);
|
||||
char *buf = (char *) calloc(1, total_length);
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
savbuf = buf;
|
||||
|
|
|
@ -131,7 +131,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
|||
total_length = (rep.all_clients_count + rep.this_client_count) *
|
||||
sizeof(XEventClass);
|
||||
rep.length = bytes_to_int32(total_length);
|
||||
buf = (XEventClass *) malloc(total_length);
|
||||
buf = calloc(1, total_length);
|
||||
|
||||
tclient = buf;
|
||||
aclient = buf + rep.this_client_count;
|
||||
|
|
|
@ -104,9 +104,7 @@ typedef struct _BarrierScreen {
|
|||
|
||||
static struct PointerBarrierDevice *AllocBarrierDevice(void)
|
||||
{
|
||||
struct PointerBarrierDevice *pbd = NULL;
|
||||
|
||||
pbd = malloc(sizeof(struct PointerBarrierDevice));
|
||||
struct PointerBarrierDevice *pbd = calloc(1, sizeof(struct PointerBarrierDevice));
|
||||
if (!pbd)
|
||||
return NULL;
|
||||
|
||||
|
@ -557,15 +555,13 @@ CreatePointerBarrierClient(ClientPtr client,
|
|||
ScreenPtr screen;
|
||||
BarrierScreenPtr cs;
|
||||
int err;
|
||||
int size;
|
||||
int i;
|
||||
struct PointerBarrierClient *ret;
|
||||
CARD16 *in_devices;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
size = sizeof(*ret) + sizeof(DeviceIntPtr) * stuff->num_devices;
|
||||
ret = malloc(size);
|
||||
|
||||
const int size = sizeof(struct PointerBarrierClient)
|
||||
+ sizeof(DeviceIntPtr) * stuff->num_devices;
|
||||
struct PointerBarrierClient *ret = calloc(1, size);
|
||||
if (!ret) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
|
@ -575,9 +575,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
|
|||
static XIPropertyPtr
|
||||
XICreateDeviceProperty(Atom property)
|
||||
{
|
||||
XIPropertyPtr prop;
|
||||
|
||||
prop = (XIPropertyPtr) malloc(sizeof(XIPropertyRec));
|
||||
XIPropertyPtr prop = calloc(1, sizeof(XIPropertyRec));
|
||||
if (!prop)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ int
|
|||
compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
|
||||
WindowPtr pLayerWin;
|
||||
Bool anyMarked = FALSE;
|
||||
|
@ -151,7 +150,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
|
|||
* Only one Manual update is allowed
|
||||
*/
|
||||
if (cw && update == CompositeRedirectManual)
|
||||
for (ccw = cw->clients; ccw; ccw = ccw->next)
|
||||
for (CompClientWindowPtr ccw = cw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
return BadAccess;
|
||||
|
||||
|
@ -160,7 +159,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
|
|||
* The client *could* allocate multiple, but while supported,
|
||||
* it is not expected to be common
|
||||
*/
|
||||
ccw = malloc(sizeof(CompClientWindowRec));
|
||||
CompClientWindowPtr ccw = calloc(1, sizeof(CompClientWindowRec));
|
||||
if (!ccw)
|
||||
return BadAlloc;
|
||||
ccw->id = FakeClientID(pClient->index);
|
||||
|
@ -169,7 +168,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
|
|||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!cw) {
|
||||
cw = malloc(sizeof(CompWindowRec));
|
||||
cw = calloc(1, sizeof(CompWindowRec));
|
||||
if (!cw) {
|
||||
free(ccw);
|
||||
return BadAlloc;
|
||||
|
@ -342,14 +341,13 @@ int
|
|||
compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
|
||||
{
|
||||
CompSubwindowsPtr csw = GetCompSubwindows(pWin);
|
||||
CompClientWindowPtr ccw;
|
||||
WindowPtr pChild;
|
||||
|
||||
/*
|
||||
* Only one Manual update is allowed
|
||||
*/
|
||||
if (csw && update == CompositeRedirectManual)
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
for (CompClientWindowPtr ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
return BadAccess;
|
||||
/*
|
||||
|
@ -357,7 +355,7 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
|
|||
* The client *could* allocate multiple, but while supported,
|
||||
* it is not expected to be common
|
||||
*/
|
||||
ccw = malloc(sizeof(CompClientWindowRec));
|
||||
CompClientWindowPtr ccw = calloc(1, sizeof(CompClientWindowRec));
|
||||
if (!ccw)
|
||||
return BadAlloc;
|
||||
ccw->id = FakeClientID(pClient->index);
|
||||
|
@ -366,7 +364,7 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
|
|||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!csw) {
|
||||
csw = malloc(sizeof(CompSubwindowsRec));
|
||||
csw = calloc(1, sizeof(CompSubwindowsRec));
|
||||
if (!csw) {
|
||||
free(ccw);
|
||||
return BadAlloc;
|
||||
|
|
|
@ -700,7 +700,7 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
|
|||
|
||||
LEGAL_NEW_RESOURCE(stuff->pixmap, client);
|
||||
|
||||
if (!(newPix = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
newPix->type = XRT_PIXMAP;
|
||||
|
@ -769,7 +769,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
|||
|
||||
cs = GetCompScreen(screenInfo.screens[0]);
|
||||
if (!cs->pOverlayWin) {
|
||||
if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
|
||||
if (!(overlayWin = calloc(1, sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
overlayWin->type = XRT_WINDOW;
|
||||
|
|
|
@ -334,8 +334,6 @@ compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs)
|
|||
Bool
|
||||
compScreenInit(ScreenPtr pScreen)
|
||||
{
|
||||
CompScreenPtr cs;
|
||||
|
||||
if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
|
||||
|
@ -345,7 +343,7 @@ compScreenInit(ScreenPtr pScreen)
|
|||
|
||||
if (GetCompScreen(pScreen))
|
||||
return TRUE;
|
||||
cs = (CompScreenPtr) malloc(sizeof(CompScreenRec));
|
||||
CompScreenPtr cs = calloc(1, sizeof(CompScreenRec));
|
||||
if (!cs)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -96,9 +96,7 @@ CompOverlayClientPtr
|
|||
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
CompOverlayClientPtr pOc;
|
||||
|
||||
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
|
||||
CompOverlayClientPtr pOc = calloc(1, sizeof(CompOverlayClientRec));
|
||||
if (pOc == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ static DamageExtPtr
|
|||
DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level,
|
||||
ClientPtr client, XID id, XID drawable)
|
||||
{
|
||||
DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec));
|
||||
DamageExtPtr pDamageExt = calloc(1, sizeof(DamageExtRec));
|
||||
if (!pDamageExt)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -1363,7 +1363,7 @@ DbeExtensionInit(void)
|
|||
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
if (!(pDbeScreenPriv = malloc(sizeof(DbeScreenPrivRec)))) {
|
||||
if (!(pDbeScreenPriv = calloc(1, sizeof(DbeScreenPrivRec)))) {
|
||||
/* If we can not alloc a window or screen private,
|
||||
* then free any privates that we already alloc'ed and return
|
||||
*/
|
||||
|
|
|
@ -100,9 +100,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
|||
}
|
||||
}
|
||||
if (makeit) {
|
||||
NodePtr nd;
|
||||
|
||||
nd = malloc(sizeof(NodeRec));
|
||||
NodePtr nd = calloc(1, sizeof(NodeRec));
|
||||
if (!nd)
|
||||
return BAD_RESOURCE;
|
||||
if (lastAtom < XA_LAST_PREDEFINED) {
|
||||
|
|
|
@ -266,7 +266,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
sizebytes *= 3;
|
||||
sizebytes += sizeof(ColormapRec);
|
||||
if (mid == pScreen->defColormap) {
|
||||
pmap = malloc(sizebytes);
|
||||
pmap = calloc(1, sizebytes);
|
||||
if (!pmap)
|
||||
return BadAlloc;
|
||||
if (!dixAllocatePrivates(&pmap->devPrivates, PRIVATE_COLORMAP)) {
|
||||
|
@ -1087,9 +1087,7 @@ AllocColor(ColormapPtr pmap,
|
|||
* should be freed when the client dies */
|
||||
if ((pmap->numPixelsRed[client] == 1) &&
|
||||
(CLIENT_ID(pmap->mid) != client) && !(pmap->flags & CM_BeingCreated)) {
|
||||
colorResource *pcr;
|
||||
|
||||
pcr = malloc(sizeof(colorResource));
|
||||
colorResource *pcr = calloc(1, sizeof(colorResource));
|
||||
if (!pcr) {
|
||||
(void) FreeColors(pmap, client, 1, pPix, (Pixel) 0);
|
||||
return BadAlloc;
|
||||
|
@ -1507,7 +1505,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes,
|
|||
if (pmap->class == DirectColor)
|
||||
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
|
||||
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
|
||||
pcr = malloc(sizeof(colorResource));
|
||||
pcr = calloc(1, sizeof(colorResource));
|
||||
if (!pcr)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
@ -1574,7 +1572,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
|
|||
if (class == DirectColor)
|
||||
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
|
||||
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
|
||||
pcr = malloc(sizeof(colorResource));
|
||||
pcr = calloc(1, sizeof(colorResource));
|
||||
if (!pcr)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
@ -1977,7 +1975,7 @@ AllocShared(ColormapPtr pmap, Pixel * ppix, int c, int r, int g, int b,
|
|||
return FALSE;
|
||||
ppshared = psharedList;
|
||||
for (z = npixShared; --z >= 0;) {
|
||||
if (!(ppshared[z] = malloc(sizeof(SHAREDCOLOR)))) {
|
||||
if (!(ppshared[z] = calloc(1, sizeof(SHAREDCOLOR)))) {
|
||||
for (z++; z < npixShared; z++)
|
||||
free(ppshared[z]);
|
||||
free(psharedList);
|
||||
|
|
|
@ -376,7 +376,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
unsigned char *mskptr;
|
||||
|
||||
n = BitmapBytePad(cm.width) * (long) cm.height;
|
||||
mskptr = mskbits = malloc(n);
|
||||
mskptr = mskbits = calloc(1, n);
|
||||
if (!mskptr)
|
||||
return BadAlloc;
|
||||
while (--n >= 0)
|
||||
|
@ -427,7 +427,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
bits->refcnt = -1;
|
||||
else {
|
||||
bits->refcnt = 1;
|
||||
pShare = malloc(sizeof(GlyphShare));
|
||||
pShare = calloc(1, sizeof(GlyphShare));
|
||||
if (!pShare) {
|
||||
FreeCursorBits(bits);
|
||||
return BadAlloc;
|
||||
|
|
|
@ -1203,7 +1203,7 @@ CloseOneDevice(const DeviceIntPtr dev, DeviceIntPtr *listHead)
|
|||
* the removal of the device.
|
||||
*
|
||||
* No PresenceNotify is sent for device that the client never saw. This can
|
||||
* happen if a malloc fails during the addition of master devices. If
|
||||
* happen if a calloc fails during the addition of master devices. If
|
||||
* dev->init is FALSE it means the client never received a DeviceAdded event,
|
||||
* so let's not send a DeviceRemoved event either.
|
||||
*
|
||||
|
@ -1476,12 +1476,10 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme)
|
|||
Bool
|
||||
InitFocusClassDeviceStruct(DeviceIntPtr dev)
|
||||
{
|
||||
FocusClassPtr focc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
BUG_RETURN_VAL(dev->focus != NULL, FALSE);
|
||||
|
||||
focc = malloc(sizeof(FocusClassRec));
|
||||
FocusClassPtr focc = calloc(1, sizeof(FocusClassRec));
|
||||
if (!focc)
|
||||
return FALSE;
|
||||
UpdateCurrentTimeIf();
|
||||
|
@ -1499,11 +1497,9 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
|
|||
Bool
|
||||
InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
|
||||
{
|
||||
PtrFeedbackPtr feedc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
|
||||
feedc = malloc(sizeof(PtrFeedbackClassRec));
|
||||
PtrFeedbackPtr feedc = calloc(1, sizeof(PtrFeedbackClassRec));
|
||||
if (!feedc)
|
||||
return FALSE;
|
||||
feedc->CtrlProc = controlProc;
|
||||
|
@ -1542,11 +1538,10 @@ InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
|||
KeySym * symbols)
|
||||
{
|
||||
int i;
|
||||
StringFeedbackPtr feedc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
|
||||
feedc = malloc(sizeof(StringFeedbackClassRec));
|
||||
StringFeedbackPtr feedc = calloc(1, sizeof(StringFeedbackClassRec));
|
||||
if (!feedc)
|
||||
return FALSE;
|
||||
feedc->CtrlProc = controlProc;
|
||||
|
@ -1578,11 +1573,9 @@ Bool
|
|||
InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
|
||||
BellCtrlProcPtr controlProc)
|
||||
{
|
||||
BellFeedbackPtr feedc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
|
||||
feedc = malloc(sizeof(BellFeedbackClassRec));
|
||||
BellFeedbackPtr feedc = calloc(1, sizeof(BellFeedbackClassRec));
|
||||
if (!feedc)
|
||||
return FALSE;
|
||||
feedc->CtrlProc = controlProc;
|
||||
|
@ -1599,11 +1592,9 @@ InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
|
|||
Bool
|
||||
InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc)
|
||||
{
|
||||
LedFeedbackPtr feedc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
|
||||
feedc = malloc(sizeof(LedFeedbackClassRec));
|
||||
LedFeedbackPtr feedc = calloc(1, sizeof(LedFeedbackClassRec));
|
||||
if (!feedc)
|
||||
return FALSE;
|
||||
feedc->CtrlProc = controlProc;
|
||||
|
@ -1621,11 +1612,9 @@ Bool
|
|||
InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||
IntegerCtrlProcPtr controlProc)
|
||||
{
|
||||
IntegerFeedbackPtr feedc;
|
||||
|
||||
BUG_RETURN_VAL(dev == NULL, FALSE);
|
||||
|
||||
feedc = malloc(sizeof(IntegerFeedbackClassRec));
|
||||
IntegerFeedbackPtr feedc = calloc(1, sizeof(IntegerFeedbackClassRec));
|
||||
if (!feedc)
|
||||
return FALSE;
|
||||
feedc->CtrlProc = controlProc;
|
||||
|
|
|
@ -643,7 +643,7 @@ CreateConnectionBlock(void)
|
|||
pad_to_int32(setup.nbytesVendor) +
|
||||
(setup.numFormats * sizeof(xPixmapFormat)) +
|
||||
(setup.numRoots * sizeof(xWindowRoot));
|
||||
ConnectionInfo = malloc(lenofblock);
|
||||
ConnectionInfo = calloc(1, lenofblock);
|
||||
if (!ConnectionInfo)
|
||||
return FALSE;
|
||||
|
||||
|
@ -2574,7 +2574,6 @@ ProcUninstallColormap(ClientPtr client)
|
|||
int
|
||||
ProcListInstalledColormaps(ClientPtr client)
|
||||
{
|
||||
xListInstalledColormapsReply *preply;
|
||||
int nummaps, rc;
|
||||
WindowPtr pWin;
|
||||
|
||||
|
@ -2589,7 +2588,8 @@ ProcListInstalledColormaps(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
preply = malloc(sizeof(xListInstalledColormapsReply) +
|
||||
xListInstalledColormapsReply *preply = calloc(1,
|
||||
sizeof(xListInstalledColormapsReply) +
|
||||
pWin->drawable.pScreen->maxInstalledCmaps *
|
||||
sizeof(Colormap));
|
||||
if (!preply)
|
||||
|
@ -2704,7 +2704,7 @@ ProcAllocColorCells(ClientPtr client)
|
|||
if (rc == Success) {
|
||||
int npixels, nmasks;
|
||||
long length;
|
||||
Pixel *ppixels, *pmasks;
|
||||
Pixel *pmasks;
|
||||
|
||||
npixels = stuff->colors;
|
||||
if (!npixels) {
|
||||
|
@ -2717,7 +2717,7 @@ ProcAllocColorCells(ClientPtr client)
|
|||
}
|
||||
nmasks = stuff->planes;
|
||||
length = ((long) npixels + (long) nmasks) * sizeof(Pixel);
|
||||
ppixels = malloc(length);
|
||||
Pixel *ppixels = calloc(1, length);
|
||||
if (!ppixels)
|
||||
return BadAlloc;
|
||||
pmasks = ppixels + npixels;
|
||||
|
@ -2766,7 +2766,6 @@ ProcAllocColorPlanes(ClientPtr client)
|
|||
xAllocColorPlanesReply acpr;
|
||||
int npixels;
|
||||
long length;
|
||||
Pixel *ppixels;
|
||||
|
||||
npixels = stuff->colors;
|
||||
if (!npixels) {
|
||||
|
@ -2784,7 +2783,7 @@ ProcAllocColorPlanes(ClientPtr client)
|
|||
};
|
||||
length = (long) npixels *sizeof(Pixel);
|
||||
|
||||
ppixels = malloc(length);
|
||||
Pixel *ppixels = calloc(1, length);
|
||||
if (!ppixels)
|
||||
return BadAlloc;
|
||||
if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
|
||||
|
@ -2996,7 +2995,6 @@ ProcCreateCursor(ClientPtr client)
|
|||
PixmapPtr src;
|
||||
PixmapPtr msk;
|
||||
unsigned char *srcbits;
|
||||
unsigned char *mskbits;
|
||||
unsigned short width, height;
|
||||
long n;
|
||||
CursorMetricRec cm;
|
||||
|
@ -3044,7 +3042,8 @@ ProcCreateCursor(ClientPtr client)
|
|||
if (!srcbits)
|
||||
return BadAlloc;
|
||||
n = BitmapBytePad(width) * height;
|
||||
mskbits = malloc(n);
|
||||
|
||||
unsigned char *mskbits = calloc(1, n);
|
||||
if (!mskbits) {
|
||||
free(srcbits);
|
||||
return BadAlloc;
|
||||
|
|
|
@ -379,7 +379,6 @@ int
|
|||
OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
|
||||
const char *pfontname)
|
||||
{
|
||||
OFclosurePtr c;
|
||||
int i;
|
||||
FontPtr cached = (FontPtr) 0;
|
||||
|
||||
|
@ -412,10 +411,10 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
|
|||
return Success;
|
||||
}
|
||||
}
|
||||
c = malloc(sizeof(OFclosureRec));
|
||||
OFclosurePtr c = calloc(1, sizeof(OFclosureRec));
|
||||
if (!c)
|
||||
return BadAlloc;
|
||||
c->fontname = malloc(lenfname);
|
||||
c->fontname = calloc(1, lenfname);
|
||||
c->origFontName = pfontname;
|
||||
c->origFontNameLen = lenfname;
|
||||
if (!c->fontname) {
|
||||
|
@ -644,7 +643,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
|||
}
|
||||
if (err == FontNameAlias) {
|
||||
free(resolved);
|
||||
resolved = malloc(resolvedlen + 1);
|
||||
resolved = calloc(1, resolvedlen + 1);
|
||||
if (resolved)
|
||||
memcpy(resolved, tmpname, resolvedlen + 1);
|
||||
}
|
||||
|
@ -694,7 +693,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
|||
c->saved = c->current;
|
||||
c->haveSaved = TRUE;
|
||||
free(c->savedName);
|
||||
c->savedName = malloc(namelen + 1);
|
||||
c->savedName = calloc(1, namelen + 1);
|
||||
if (c->savedName)
|
||||
memcpy(c->savedName, name, namelen + 1);
|
||||
c->savedNameLen = namelen;
|
||||
|
@ -756,7 +755,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
|||
.sequenceNumber = client->sequence
|
||||
};
|
||||
|
||||
bufptr = bufferStart = malloc(reply.length << 2);
|
||||
bufptr = bufferStart = calloc(1, reply.length << 2);
|
||||
|
||||
if (!bufptr && reply.length) {
|
||||
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
|
||||
|
@ -814,7 +813,7 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
|
|||
if (i != Success)
|
||||
return i;
|
||||
|
||||
if (!(c = malloc(sizeof *c)))
|
||||
if (!(c = calloc(1, sizeof *c)))
|
||||
return BadAlloc;
|
||||
c->fpe_list = xallocarray(num_fpes, sizeof(FontPathElementPtr));
|
||||
if (!c->fpe_list) {
|
||||
|
@ -934,7 +933,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
|
|||
c->haveSaved = TRUE;
|
||||
c->savedNumFonts = numFonts;
|
||||
free(c->savedName);
|
||||
c->savedName = malloc(namelen + 1);
|
||||
c->savedName = calloc(1, namelen + 1);
|
||||
if (c->savedName)
|
||||
memcpy(c->savedName, name, namelen + 1);
|
||||
aliascount = 20;
|
||||
|
@ -1060,7 +1059,7 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
|
|||
if (i != Success)
|
||||
return i;
|
||||
|
||||
if (!(c = malloc(sizeof *c)))
|
||||
if (!(c = calloc(1, sizeof *c)))
|
||||
goto badAlloc;
|
||||
c->fpe_list = xallocarray(num_fpes, sizeof(FontPathElementPtr));
|
||||
if (!c->fpe_list) {
|
||||
|
@ -1219,7 +1218,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
/* We're putting the client to sleep. We need to do a few things
|
||||
to ensure successful and atomic-appearing execution of the
|
||||
remainder of the request. First, copy the remainder of the
|
||||
request into a safe malloc'd area. Second, create a scratch GC
|
||||
request into a safe calloc'd area. Second, create a scratch GC
|
||||
to use for the remainder of the request. Third, mark all fonts
|
||||
referenced in the remainder of the request to prevent their
|
||||
deallocation. Fourth, make the original GC look like the
|
||||
|
@ -1231,9 +1230,9 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
indicated by client_state = START_SLEEP. */
|
||||
|
||||
/* Step 1 */
|
||||
/* Allocate a malloc'd closure structure to replace
|
||||
/* Allocate a calloc'd closure structure to replace
|
||||
the local one we were passed */
|
||||
new_closure = malloc(sizeof(PTclosureRec));
|
||||
new_closure = calloc(1, sizeof(PTclosureRec));
|
||||
if (!new_closure) {
|
||||
err = BadAlloc;
|
||||
goto bail;
|
||||
|
@ -1241,7 +1240,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
*new_closure = *c;
|
||||
|
||||
len = new_closure->endReq - new_closure->pElt;
|
||||
new_closure->data = malloc(len);
|
||||
new_closure->data = calloc(1, len);
|
||||
if (!new_closure->data) {
|
||||
free(new_closure);
|
||||
err = BadAlloc;
|
||||
|
@ -1411,7 +1410,6 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
if (!ClientIsAsleep(client)) {
|
||||
GC *pGC;
|
||||
unsigned char *data;
|
||||
ITclosurePtr new_closure;
|
||||
ITclosurePtr old_closure;
|
||||
|
||||
/* We're putting the client to sleep. We need to
|
||||
|
@ -1419,7 +1417,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
in doPolyText, but much simpler because the
|
||||
request structure is much simpler. */
|
||||
|
||||
new_closure = malloc(sizeof(ITclosureRec));
|
||||
ITclosurePtr new_closure = calloc(1, sizeof(ITclosureRec));
|
||||
if (!new_closure) {
|
||||
err = BadAlloc;
|
||||
goto bail;
|
||||
|
@ -1617,13 +1615,12 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
|
|||
}
|
||||
/* if error or can't do it, act like it's a new one */
|
||||
if (!fpe) {
|
||||
char *name;
|
||||
fpe = malloc(sizeof(FontPathElementRec));
|
||||
fpe = calloc(1, sizeof(FontPathElementRec));
|
||||
if (!fpe) {
|
||||
err = BadAlloc;
|
||||
goto bail;
|
||||
}
|
||||
name = malloc(len + 1);
|
||||
char *name = calloc(1, len + 1);
|
||||
if (!name) {
|
||||
free(fpe);
|
||||
err = BadAlloc;
|
||||
|
@ -1730,7 +1727,7 @@ SetDefaultFontPath(const char *path)
|
|||
|
||||
/* get enough for string, plus values -- use up commas */
|
||||
len = strlen(temp_path) + 1;
|
||||
nump = cp = newpath = malloc(len);
|
||||
nump = cp = newpath = calloc(1, len);
|
||||
if (!newpath) {
|
||||
free(temp_path);
|
||||
return BadAlloc;
|
||||
|
|
|
@ -532,9 +532,7 @@ Bool
|
|||
QueueWorkProc(Bool (*function) (ClientPtr pClient, void *closure),
|
||||
ClientPtr client, void *closure)
|
||||
{
|
||||
WorkQueuePtr q;
|
||||
|
||||
q = malloc(sizeof *q);
|
||||
WorkQueuePtr q = calloc(1, sizeof *q);
|
||||
if (!q)
|
||||
return FALSE;
|
||||
q->function = function;
|
||||
|
@ -566,9 +564,7 @@ static SleepQueuePtr sleepQueue = NULL;
|
|||
Bool
|
||||
ClientSleep(ClientPtr client, ClientSleepProcPtr function, void *closure)
|
||||
{
|
||||
SleepQueuePtr q;
|
||||
|
||||
q = malloc(sizeof *q);
|
||||
SleepQueuePtr q = calloc(1, sizeof *q);
|
||||
if (!q)
|
||||
return FALSE;
|
||||
|
||||
|
@ -655,9 +651,7 @@ static CallbackListPtr **listsToCleanup = NULL;
|
|||
static Bool
|
||||
_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
|
||||
{
|
||||
CallbackPtr cbr;
|
||||
|
||||
cbr = malloc(sizeof(CallbackRec));
|
||||
CallbackPtr cbr = calloc(1, sizeof(CallbackRec));
|
||||
if (!cbr)
|
||||
return FALSE;
|
||||
cbr->proc = callback;
|
||||
|
@ -777,12 +771,12 @@ _DeleteCallbackList(CallbackListPtr *pcbl)
|
|||
static Bool
|
||||
CreateCallbackList(CallbackListPtr *pcbl)
|
||||
{
|
||||
CallbackListPtr cbl;
|
||||
int i;
|
||||
|
||||
if (!pcbl)
|
||||
return FALSE;
|
||||
cbl = malloc(sizeof(CallbackListRec));
|
||||
|
||||
CallbackListPtr cbl = calloc(1, sizeof(CallbackListRec));
|
||||
if (!cbl)
|
||||
return FALSE;
|
||||
cbl->inCallback = 0;
|
||||
|
|
|
@ -1141,7 +1141,6 @@ void
|
|||
EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
|
||||
{
|
||||
QdEventPtr tail = NULL;
|
||||
QdEventPtr qe;
|
||||
SpritePtr pSprite = device->spriteInfo->sprite;
|
||||
int eventlen;
|
||||
DeviceEvent *event = &ev->device_event;
|
||||
|
@ -1202,7 +1201,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
|
||||
eventlen = sizeof(InternalEvent);
|
||||
|
||||
qe = malloc(sizeof(QdEventRec) + eventlen);
|
||||
QdEventPtr qe = calloc(1, sizeof(QdEventRec) + eventlen);
|
||||
if (!qe)
|
||||
return;
|
||||
xorg_list_init(&qe->next);
|
||||
|
@ -4588,7 +4587,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
|
|||
check = 0;
|
||||
if (!pWin->optional && !MakeWindowOptional(pWin))
|
||||
return BadAlloc;
|
||||
others = malloc(sizeof(OtherClients));
|
||||
others = calloc(1, sizeof(OtherClients));
|
||||
if (!others)
|
||||
return BadAlloc;
|
||||
others->mask = mask;
|
||||
|
|
|
@ -283,7 +283,7 @@ ProcListExtensions(ClientPtr client)
|
|||
reply.nExtensions += 1;
|
||||
}
|
||||
reply.length = bytes_to_int32(total_length);
|
||||
buffer = bufptr = malloc(total_length);
|
||||
buffer = bufptr = calloc(1, total_length);
|
||||
if (!buffer)
|
||||
return BadAlloc;
|
||||
for (i = 0; i < NumExtensions; i++) {
|
||||
|
|
16
dix/gc.c
16
dix/gc.c
|
@ -361,9 +361,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
|
|||
}
|
||||
}
|
||||
else if (newdash != 0) {
|
||||
unsigned char *dash;
|
||||
|
||||
dash = malloc(2 * sizeof(unsigned char));
|
||||
unsigned char *dash = calloc(2, sizeof(unsigned char));
|
||||
if (dash) {
|
||||
if (pGC->dash != DefaultDash)
|
||||
free(pGC->dash);
|
||||
|
@ -726,10 +724,8 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
|
|||
}
|
||||
}
|
||||
else {
|
||||
unsigned char *dash;
|
||||
unsigned int i;
|
||||
|
||||
dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char));
|
||||
unsigned char *dash = calloc(pgcSrc->numInDashList, sizeof(unsigned char));
|
||||
if (dash) {
|
||||
if (pgcDst->dash != DefaultDash)
|
||||
free(pgcDst->dash);
|
||||
|
@ -924,9 +920,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
|
|||
}
|
||||
|
||||
if (ndash & 1)
|
||||
p = malloc(2 * ndash * sizeof(unsigned char));
|
||||
p = calloc(2 * ndash, sizeof(unsigned char));
|
||||
else
|
||||
p = malloc(ndash * sizeof(unsigned char));
|
||||
p = calloc(ndash, sizeof(unsigned char));
|
||||
if (!p)
|
||||
return BadAlloc;
|
||||
|
||||
|
@ -1005,13 +1001,13 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
|
|||
xRectangle *prects, int ordering)
|
||||
{
|
||||
int newct, size;
|
||||
xRectangle *prectsNew;
|
||||
|
||||
newct = VerifyRectOrder(nrects, prects, ordering);
|
||||
if (newct < 0)
|
||||
return BadMatch;
|
||||
size = nrects * sizeof(xRectangle);
|
||||
prectsNew = malloc(size);
|
||||
|
||||
xRectangle *prectsNew = calloc(1, size);
|
||||
if (!prectsNew && size)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord ** buff, unsigned long start,
|
|||
else
|
||||
size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
|
||||
|
||||
*buff = malloc(size * pDev->valuator->numMotionEvents);
|
||||
*buff = calloc(size, pDev->valuator->numMotionEvents);
|
||||
if (!(*buff))
|
||||
return 0;
|
||||
obuff = (char *) *buff;
|
||||
|
|
|
@ -279,7 +279,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
|
|||
if (src->modifiersDetail.pMask) {
|
||||
int len = MasksPerDetailMask * sizeof(Mask);
|
||||
|
||||
mdetails_mask = malloc(len);
|
||||
mdetails_mask = calloc(1, len);
|
||||
if (!mdetails_mask)
|
||||
return FALSE;
|
||||
memcpy(mdetails_mask, src->modifiersDetail.pMask, len);
|
||||
|
@ -288,7 +288,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
|
|||
if (src->detail.pMask) {
|
||||
int len = MasksPerDetailMask * sizeof(Mask);
|
||||
|
||||
details_mask = malloc(len);
|
||||
details_mask = calloc(1, len);
|
||||
if (!details_mask) {
|
||||
free(mdetails_mask);
|
||||
return FALSE;
|
||||
|
@ -345,10 +345,9 @@ DeletePassiveGrab(void *value, XID id)
|
|||
static Mask *
|
||||
DeleteDetailFromMask(Mask *pDetailMask, unsigned int detail)
|
||||
{
|
||||
Mask *mask;
|
||||
int i;
|
||||
|
||||
mask = malloc(sizeof(Mask) * MasksPerDetailMask);
|
||||
Mask *mask = calloc(MasksPerDetailMask, sizeof(Mask));
|
||||
if (mask) {
|
||||
if (pDetailMask)
|
||||
for (i = 0; i < MasksPerDetailMask; i++)
|
||||
|
|
|
@ -469,7 +469,6 @@ _dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear,
|
|||
unsigned offset, DevPrivateType type)
|
||||
{
|
||||
unsigned totalSize;
|
||||
void *object;
|
||||
PrivatePtr privates;
|
||||
PrivatePtr *devPrivates;
|
||||
|
||||
|
@ -480,7 +479,7 @@ _dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear,
|
|||
/* round up so that void * is aligned */
|
||||
baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
||||
totalSize = baseSize + global_keys[type].offset;
|
||||
object = malloc(totalSize);
|
||||
void *object = calloc(1, totalSize);
|
||||
if (!object)
|
||||
return NULL;
|
||||
|
||||
|
@ -512,7 +511,7 @@ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type)
|
|||
p = NULL;
|
||||
}
|
||||
else {
|
||||
if (!(p = malloc(size)))
|
||||
if (!(p = calloc(1, size)))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -692,7 +691,6 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
|
|||
DevPrivateType type)
|
||||
{
|
||||
unsigned totalSize;
|
||||
void *object;
|
||||
PrivatePtr privates;
|
||||
PrivatePtr *devPrivates;
|
||||
int privates_size;
|
||||
|
@ -708,7 +706,7 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
|
|||
/* round up so that pointer is aligned */
|
||||
baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
||||
totalSize = baseSize + privates_size;
|
||||
object = malloc(totalSize);
|
||||
void *object = calloc(1, totalSize);
|
||||
if (!object)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -261,7 +261,6 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
PropertyPtr pProp;
|
||||
PropertyRec savedProp;
|
||||
int sizeInBytes, totalSize, rc;
|
||||
unsigned char *data;
|
||||
Mask access_mode;
|
||||
|
||||
sizeInBytes = format >> 3;
|
||||
|
@ -277,7 +276,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp = dixAllocateObjectWithPrivates(PropertyRec, PRIVATE_PROPERTY);
|
||||
if (!pProp)
|
||||
return BadAlloc;
|
||||
data = malloc(totalSize);
|
||||
unsigned char *data = calloc(1, totalSize);
|
||||
if (totalSize) {
|
||||
if (!data) {
|
||||
dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
|
||||
|
@ -316,7 +315,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
savedProp = *pProp;
|
||||
|
||||
if (mode == PropModeReplace) {
|
||||
data = malloc(totalSize);
|
||||
unsigned char *data = calloc(1, totalSize);
|
||||
if (totalSize) {
|
||||
if (!data)
|
||||
return BadAlloc;
|
||||
|
@ -331,7 +330,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
/* do nothing */
|
||||
}
|
||||
else if (mode == PropModeAppend) {
|
||||
data = xallocarray(pProp->size + len, sizeInBytes);
|
||||
unsigned char *data = calloc(pProp->size + len, sizeInBytes);
|
||||
if (!data)
|
||||
return BadAlloc;
|
||||
memcpy(data, pProp->data, pProp->size * sizeInBytes);
|
||||
|
@ -340,7 +339,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
|||
pProp->size += len;
|
||||
}
|
||||
else if (mode == PropModePrepend) {
|
||||
data = xallocarray(len + pProp->size, sizeInBytes);
|
||||
unsigned char *data = calloc(len + pProp->size, sizeInBytes);
|
||||
if (!data)
|
||||
return BadAlloc;
|
||||
memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
|
||||
|
|
16
dix/region.c
16
dix/region.c
|
@ -227,16 +227,14 @@ InitRegions(void)
|
|||
|
||||
/*****************************************************************
|
||||
* RegionCreate(rect, size)
|
||||
* This routine does a simple malloc to make a structure of
|
||||
* This routine does a simple calloc to make a structure of
|
||||
* REGION of "size" number of rectangles.
|
||||
*****************************************************************/
|
||||
|
||||
RegionPtr
|
||||
RegionCreate(BoxPtr rect, int size)
|
||||
{
|
||||
RegionPtr pReg;
|
||||
|
||||
pReg = (RegionPtr) malloc(sizeof(RegionRec));
|
||||
RegionPtr pReg = calloc(1, sizeof(RegionRec));
|
||||
if (!pReg)
|
||||
return &RegionBrokenRegion;
|
||||
|
||||
|
@ -348,7 +346,7 @@ RegionRectAlloc(RegionPtr pRgn, int n)
|
|||
if (!pRgn->data) {
|
||||
n++;
|
||||
rgnSize = RegionSizeof(n);
|
||||
pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL;
|
||||
pRgn->data = (rgnSize > 0) ? calloc(1, rgnSize) : NULL;
|
||||
if (!pRgn->data)
|
||||
return RegionBreak(pRgn);
|
||||
pRgn->data->numRects = 1;
|
||||
|
@ -356,7 +354,7 @@ RegionRectAlloc(RegionPtr pRgn, int n)
|
|||
}
|
||||
else if (!pRgn->data->size) {
|
||||
rgnSize = RegionSizeof(n);
|
||||
pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL;
|
||||
pRgn->data = (rgnSize > 0) ? calloc(1, rgnSize) : NULL;
|
||||
if (!pRgn->data)
|
||||
return RegionBreak(pRgn);
|
||||
pRgn->data->numRects = 0;
|
||||
|
@ -1142,7 +1140,6 @@ RegionValidate(RegionPtr badreg, Bool *pOverlap)
|
|||
} RegionInfo;
|
||||
|
||||
int numRects; /* Original numRects for badreg */
|
||||
RegionInfo *ri; /* Array of current regions */
|
||||
int numRI; /* Number of entries used in ri */
|
||||
int sizeRI; /* Number of entries available in ri */
|
||||
int i; /* Index into rects */
|
||||
|
@ -1185,7 +1182,7 @@ RegionValidate(RegionPtr badreg, Bool *pOverlap)
|
|||
|
||||
/* Set up the first region to be the first rectangle in badreg */
|
||||
/* Note that step 2 code will never overflow the ri[0].reg rects array */
|
||||
ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
|
||||
RegionInfo *ri = calloc(4, sizeof(RegionInfo));
|
||||
if (!ri)
|
||||
return RegionBreak(badreg);
|
||||
sizeRI = 4;
|
||||
|
@ -1316,7 +1313,6 @@ RegionFromRects(int nrects, xRectangle *prect, int ctype)
|
|||
|
||||
RegionPtr pRgn;
|
||||
size_t rgnSize;
|
||||
RegDataPtr pData;
|
||||
BoxPtr pBox;
|
||||
int i;
|
||||
int x1, y1, x2, y2;
|
||||
|
@ -1343,7 +1339,7 @@ RegionFromRects(int nrects, xRectangle *prect, int ctype)
|
|||
return pRgn;
|
||||
}
|
||||
rgnSize = RegionSizeof(nrects);
|
||||
pData = (rgnSize > 0) ? malloc(rgnSize) : NULL;
|
||||
RegDataPtr pData = (rgnSize > 0) ? calloc(1, rgnSize) : NULL;
|
||||
if (!pData) {
|
||||
RegionBreak(pRgn);
|
||||
return pRgn;
|
||||
|
|
|
@ -649,13 +649,13 @@ InitClientResources(ClientPtr client)
|
|||
lastResourceClass = RC_LASTPREDEF;
|
||||
TypeMask = RC_LASTPREDEF - 1;
|
||||
free(resourceTypes);
|
||||
resourceTypes = malloc(sizeof(predefTypes));
|
||||
resourceTypes = calloc(1, sizeof(predefTypes));
|
||||
if (!resourceTypes)
|
||||
return FALSE;
|
||||
memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
|
||||
}
|
||||
clientTable[i = client->index].resources =
|
||||
malloc(INITBUCKETS * sizeof(ResourcePtr));
|
||||
calloc(INITBUCKETS, sizeof(ResourcePtr));
|
||||
if (!clientTable[i].resources)
|
||||
return FALSE;
|
||||
clientTable[i].buckets = INITBUCKETS;
|
||||
|
@ -808,7 +808,7 @@ AddResource(XID id, RESTYPE type, void *value)
|
|||
{
|
||||
int client;
|
||||
ClientResourceRec *rrec;
|
||||
ResourcePtr res, *head;
|
||||
ResourcePtr *head;
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
|
||||
|
@ -823,7 +823,7 @@ AddResource(XID id, RESTYPE type, void *value)
|
|||
if ((rrec->elements >= 4 * rrec->buckets) && (rrec->hashsize < MAXHASHSIZE))
|
||||
RebuildTable(client);
|
||||
head = &rrec->resources[HashResourceID(id, clientTable[client].hashsize)];
|
||||
res = malloc(sizeof(ResourceRec));
|
||||
ResourcePtr res = calloc(1, sizeof(ResourceRec));
|
||||
if (!res) {
|
||||
(*resourceTypes[type & TypeMask].deleteFunc) (value, id);
|
||||
return FALSE;
|
||||
|
|
|
@ -94,7 +94,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
|
|||
CARD32 tmpbuf[1];
|
||||
|
||||
/* Allocate as big a buffer as we can... */
|
||||
while (!(pbufT = malloc(bufsize))) {
|
||||
while (!(pbufT = calloc(1, bufsize))) {
|
||||
bufsize >>= 1;
|
||||
if (bufsize == 4) {
|
||||
pbufT = tmpbuf;
|
||||
|
@ -141,7 +141,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
|
|||
short tmpbuf[2];
|
||||
|
||||
/* Allocate as big a buffer as we can... */
|
||||
while (!(pbufT = malloc(bufsize))) {
|
||||
while (!(pbufT = calloc(1, bufsize))) {
|
||||
bufsize >>= 1;
|
||||
if (bufsize == 4) {
|
||||
pbufT = tmpbuf;
|
||||
|
@ -1130,9 +1130,7 @@ SwapConnSetupInfo(char *pInfo, char *pInfoT)
|
|||
void _X_COLD
|
||||
WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
|
||||
{
|
||||
char *pInfoTBase;
|
||||
|
||||
pInfoTBase = malloc(size);
|
||||
char *pInfoTBase = calloc(1, size);
|
||||
if (!pInfoTBase) {
|
||||
pClient->noClientException = -1;
|
||||
return;
|
||||
|
|
14
dix/window.c
14
dix/window.c
|
@ -592,7 +592,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
|||
pWin->parent = NullWindow;
|
||||
SetWindowToDefaults(pWin);
|
||||
|
||||
pWin->optional = malloc(sizeof(WindowOptRec));
|
||||
pWin->optional = calloc(1, sizeof(WindowOptRec));
|
||||
if (!pWin->optional)
|
||||
return FALSE;
|
||||
|
||||
|
@ -3216,7 +3216,6 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
|
|||
Mask mask;
|
||||
WindowPtr pWin;
|
||||
CursorMetricRec cm;
|
||||
unsigned char *srcbits, *mskbits;
|
||||
CursorPtr cursor;
|
||||
XID cursorID = 0;
|
||||
int attri;
|
||||
|
@ -3254,8 +3253,8 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
|
|||
cm.height = 16;
|
||||
cm.xhot = 8;
|
||||
cm.yhot = 8;
|
||||
srcbits = malloc(BitmapBytePad(32) * 16);
|
||||
mskbits = malloc(BitmapBytePad(32) * 16);
|
||||
unsigned char *srcbits = calloc(16, BitmapBytePad(32));
|
||||
unsigned char *mskbits = calloc(16, BitmapBytePad(32));
|
||||
if (!srcbits || !mskbits) {
|
||||
free(srcbits);
|
||||
free(mskbits);
|
||||
|
@ -3395,12 +3394,12 @@ CheckWindowOptionalNeed(WindowPtr w)
|
|||
Bool
|
||||
MakeWindowOptional(WindowPtr pWin)
|
||||
{
|
||||
WindowOptPtr optional;
|
||||
WindowOptPtr parentOptional;
|
||||
|
||||
if (pWin->optional)
|
||||
return TRUE;
|
||||
optional = malloc(sizeof(WindowOptRec));
|
||||
|
||||
WindowOptPtr optional = calloc(1, sizeof(WindowOptRec));
|
||||
if (!optional)
|
||||
return FALSE;
|
||||
optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
|
||||
|
@ -3491,12 +3490,11 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
|
|||
}
|
||||
else {
|
||||
/* no device cursor yet */
|
||||
DevCursNodePtr pNewNode;
|
||||
|
||||
if (!pCursor)
|
||||
return Success;
|
||||
|
||||
pNewNode = malloc(sizeof(DevCursNodeRec));
|
||||
DevCursNodePtr pNewNode = calloc(1, sizeof(DevCursNodeRec));
|
||||
pNewNode->dev = pDev;
|
||||
pNewNode->next = pWin->optional->deviceCursors;
|
||||
pWin->optional->deviceCursors = pNewNode;
|
||||
|
|
|
@ -96,7 +96,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
|
|||
pExaPixmap->use_gpu_copy = FALSE;
|
||||
|
||||
if (w == 1 && h == 1) {
|
||||
pExaPixmap->sys_ptr = malloc(paddedWidth);
|
||||
pExaPixmap->sys_ptr = calloc(1, paddedWidth);
|
||||
|
||||
/* Set up damage tracking */
|
||||
pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
|
||||
|
|
|
@ -238,7 +238,7 @@ exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
|
|||
|
||||
/* save extra space in new area */
|
||||
if (real_size < area->size) {
|
||||
ExaOffscreenArea *new_area = malloc(sizeof(ExaOffscreenArea));
|
||||
ExaOffscreenArea *new_area = calloc(1, sizeof(ExaOffscreenArea));
|
||||
|
||||
if (!new_area)
|
||||
return NULL;
|
||||
|
@ -634,11 +634,9 @@ Bool
|
|||
exaOffscreenInit(ScreenPtr pScreen)
|
||||
{
|
||||
ExaScreenPriv(pScreen);
|
||||
ExaOffscreenArea *area;
|
||||
|
||||
/* Allocate a big free area */
|
||||
area = malloc(sizeof(ExaOffscreenArea));
|
||||
|
||||
ExaOffscreenArea *area = calloc(1, sizeof(ExaOffscreenArea));
|
||||
if (!area)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -273,7 +273,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
int nvisuals;
|
||||
int ndepths;
|
||||
VisualID defaultVisual;
|
||||
FbOverlayScrPrivPtr pScrPriv;
|
||||
|
||||
if (!dixRegisterPrivateKey
|
||||
(&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
|
||||
|
@ -282,7 +281,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
if (bpp1 == 24 || bpp2 == 24)
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = malloc(sizeof(FbOverlayScrPrivRec));
|
||||
FbOverlayScrPrivPtr pScrPriv = calloc(1, sizeof(FbOverlayScrPrivRec));
|
||||
if (!pScrPriv)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -58,11 +58,10 @@ glamor_compile_glsl_prog(GLenum type, const char *source)
|
|||
glCompileShader(prog);
|
||||
glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
|
||||
if (!ok) {
|
||||
GLchar *info;
|
||||
GLint size;
|
||||
|
||||
glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
|
||||
info = malloc(size);
|
||||
GLchar *info = calloc(1, size);
|
||||
if (info) {
|
||||
glGetShaderInfoLog(prog, size, NULL, info);
|
||||
ErrorF("Failed to compile %s: %s\n",
|
||||
|
@ -98,11 +97,10 @@ glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
|
|||
glLinkProgram(prog);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
|
||||
if (!ok) {
|
||||
GLchar *info;
|
||||
GLint size;
|
||||
|
||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
|
||||
info = malloc(size);
|
||||
GLchar *info = calloc(1, size);
|
||||
|
||||
glGetProgramInfoLog(prog, size, NULL, info);
|
||||
ErrorF("Failed to link: %s\n", info);
|
||||
|
|
|
@ -51,7 +51,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
unsigned char c[2];
|
||||
CharInfoPtr glyph;
|
||||
unsigned long count;
|
||||
char *bits;
|
||||
|
||||
if (!glamor_glsl_has_ints(glamor_priv))
|
||||
return NULL;
|
||||
|
@ -102,7 +101,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
/* fallback if we don't fit inside a texture */
|
||||
return NULL;
|
||||
}
|
||||
bits = malloc(overall_width * overall_height);
|
||||
char *bits = calloc(overall_width, overall_height);
|
||||
if (!bits)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -1171,7 +1171,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
&& glamor_pixmap_priv_is_large(source_pixmap_priv)) {
|
||||
/* XXX self-copy... */
|
||||
need_free_source_pixmap_priv = source_pixmap_priv;
|
||||
source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
|
||||
source_pixmap_priv = calloc(1, sizeof(*source_pixmap_priv));
|
||||
*source_pixmap_priv = *need_free_source_pixmap_priv;
|
||||
need_free_source_pixmap_priv = source_pixmap_priv;
|
||||
}
|
||||
|
|
|
@ -272,15 +272,15 @@ __glXcombine_strings(const char *cext_string, const char *sext_string)
|
|||
clen = strlen(cext_string);
|
||||
slen = strlen(sext_string);
|
||||
if (clen > slen) {
|
||||
combo_string = (char *) malloc(slen + 2);
|
||||
s1 = (char *) malloc(slen + 2);
|
||||
combo_string = (char *) calloc(1, slen + 2);
|
||||
s1 = (char *) calloc(1, slen + 2);
|
||||
if (s1)
|
||||
strcpy(s1, sext_string);
|
||||
s2 = cext_string;
|
||||
}
|
||||
else {
|
||||
combo_string = (char *) malloc(clen + 2);
|
||||
s1 = (char *) malloc(clen + 2);
|
||||
combo_string = (char *) calloc(1, clen + 2);
|
||||
s1 = (char *) calloc(1, clen + 2);
|
||||
if (s1)
|
||||
strcpy(s1, cext_string);
|
||||
s2 = sext_string;
|
||||
|
|
|
@ -126,7 +126,6 @@ static int dispatch_GLXQueryVersion(ClientPtr client)
|
|||
static int dispatch_GLXClientInfo(ClientPtr client)
|
||||
{
|
||||
GlxServerVendor *vendor;
|
||||
void *requestCopy = NULL;
|
||||
size_t requestSize = client->req_len * 4;
|
||||
|
||||
if (client->minorOp == X_GLXClientInfo) {
|
||||
|
@ -142,7 +141,7 @@ static int dispatch_GLXClientInfo(ClientPtr client)
|
|||
// We'll forward this request to each vendor library. Since a vendor might
|
||||
// modify the request data in place (e.g., for byte swapping), make a copy
|
||||
// of the request first.
|
||||
requestCopy = malloc(requestSize);
|
||||
void *requestCopy = calloc(1, requestSize);
|
||||
if (requestCopy == NULL) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
|
|||
widthPadded = GLYPHWIDTHBYTESPADDED(pci);
|
||||
|
||||
/*
|
||||
** Use the local buf if possible, otherwise malloc.
|
||||
** Use the local buf if possible, otherwise calloc.
|
||||
*/
|
||||
allocBytes = widthPadded * h;
|
||||
if (allocBytes <= __GL_CHAR_BUF_SIZE) {
|
||||
|
@ -72,7 +72,7 @@ __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
|
|||
allocbuf = 0;
|
||||
}
|
||||
else {
|
||||
p = (unsigned char *) malloc(allocBytes);
|
||||
p = calloc(1, allocBytes);
|
||||
if (!p)
|
||||
return BadAlloc;
|
||||
allocbuf = p;
|
||||
|
|
|
@ -75,9 +75,7 @@ ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
|
|||
Bool
|
||||
ephyrCardInit(KdCardInfo * card)
|
||||
{
|
||||
EphyrPriv *priv;
|
||||
|
||||
priv = (EphyrPriv *) malloc(sizeof(EphyrPriv));
|
||||
EphyrPriv *priv = calloc(1, sizeof(EphyrPriv));
|
||||
if (!priv)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -144,11 +144,10 @@ ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs)
|
|||
glLinkProgram(prog);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
|
||||
if (!ok) {
|
||||
GLchar *info;
|
||||
GLint size;
|
||||
|
||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
|
||||
info = malloc(size);
|
||||
GLchar *info = calloc(1, size);
|
||||
|
||||
glGetProgramInfoLog(prog, size, NULL, info);
|
||||
ErrorF("Failed to link: %s\n", info);
|
||||
|
@ -352,7 +351,7 @@ ephyr_glamor_screen_init(xcb_window_t win, xcb_visualid_t vid)
|
|||
|
||||
glamor = calloc(1, sizeof(struct ephyr_glamor));
|
||||
if (!glamor) {
|
||||
FatalError("malloc");
|
||||
FatalError("calloc");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,6 @@ hostx_get_output_geometry(const char *output,
|
|||
int *width, int *height)
|
||||
{
|
||||
int i, name_len = 0, output_found = FALSE;
|
||||
char *name = NULL;
|
||||
xcb_generic_error_t *error;
|
||||
xcb_randr_query_version_cookie_t version_c;
|
||||
xcb_randr_query_version_reply_t *version_r;
|
||||
|
@ -300,7 +299,7 @@ hostx_get_output_geometry(const char *output,
|
|||
|
||||
/* Get output name */
|
||||
name_len = xcb_randr_get_output_info_name_length(output_info_r);
|
||||
name = malloc(name_len + 1);
|
||||
char *name = calloc(1, name_len + 1);
|
||||
strncpy(name, (char*)xcb_randr_get_output_info_name(output_info_r), name_len);
|
||||
name[name_len] = '\0';
|
||||
|
||||
|
@ -524,7 +523,6 @@ hostx_init(void)
|
|||
uint32_t pixel;
|
||||
int index;
|
||||
char *tmpstr;
|
||||
char *class_hint;
|
||||
size_t class_len;
|
||||
xcb_screen_t *xscreen;
|
||||
xcb_rectangle_t rect = { 0, 0, 1, 1 };
|
||||
|
@ -649,7 +647,7 @@ hostx_init(void)
|
|||
if (tmpstr && (!ephyrResNameFromCmd))
|
||||
ephyrResName = tmpstr;
|
||||
class_len = strlen(ephyrResName) + 1 + strlen("Xephyr") + 1;
|
||||
class_hint = malloc(class_len);
|
||||
char *class_hint = calloc(1, class_len);
|
||||
if (class_hint) {
|
||||
strcpy(class_hint, ephyrResName);
|
||||
strcpy(class_hint + strlen(ephyrResName) + 1, "Xephyr");
|
||||
|
|
|
@ -133,7 +133,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
|
|||
KdXvScreenKey = XvGetScreenKey();
|
||||
PortResource = XvGetRTPort();
|
||||
|
||||
ScreenPriv = malloc(sizeof(KdXVScreenRec));
|
||||
ScreenPriv = calloc(1, sizeof(KdXVScreenRec));
|
||||
dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
|
||||
|
||||
if (!ScreenPriv)
|
||||
|
@ -721,7 +721,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
|
|||
}
|
||||
|
||||
if (!winPriv) {
|
||||
winPriv = malloc(sizeof(KdXVWindowRec));
|
||||
winPriv = calloc(1, sizeof(KdXVWindowRec));
|
||||
if (!winPriv)
|
||||
return BadAlloc;
|
||||
winPriv->PortRec = portPriv;
|
||||
|
|
|
@ -694,7 +694,7 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
|
|||
#endif
|
||||
|
||||
case NORMAL_MEMORY_FB:
|
||||
pvfb->pXWDHeader = (XWDFileHeader *) malloc(pvfb->sizeInBytes);
|
||||
pvfb->pXWDHeader = (XWDFileHeader *) calloc(1, pvfb->sizeInBytes);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -324,16 +324,14 @@ listPossibleVideoDrivers(XF86MatchedDrivers *md)
|
|||
static Bool
|
||||
copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
|
||||
{
|
||||
confScreenPtr nscreen;
|
||||
GDevPtr cptr = NULL;
|
||||
char *identifier;
|
||||
|
||||
nscreen = malloc(sizeof(confScreenRec));
|
||||
confScreenPtr nscreen = calloc(1, sizeof(confScreenRec));
|
||||
if (!nscreen)
|
||||
return FALSE;
|
||||
memcpy(nscreen, oscreen, sizeof(confScreenRec));
|
||||
|
||||
cptr = malloc(sizeof(GDevRec));
|
||||
GDevPtr cptr = calloc(1, sizeof(GDevRec));
|
||||
if (!cptr) {
|
||||
free(nscreen);
|
||||
return FALSE;
|
||||
|
|
|
@ -339,9 +339,7 @@ configureLayoutSection(void)
|
|||
ptr->lay_identifier = "X.org Configured";
|
||||
|
||||
{
|
||||
XF86ConfInputrefPtr iptr;
|
||||
|
||||
iptr = malloc(sizeof(XF86ConfInputrefRec));
|
||||
XF86ConfInputrefPtr iptr = calloc(1, sizeof(XF86ConfInputrefRec));
|
||||
iptr->list.next = NULL;
|
||||
iptr->iref_option_lst = NULL;
|
||||
iptr->iref_inputdev_str = XNFstrdup("Mouse0");
|
||||
|
@ -353,9 +351,7 @@ configureLayoutSection(void)
|
|||
}
|
||||
|
||||
{
|
||||
XF86ConfInputrefPtr iptr;
|
||||
|
||||
iptr = malloc(sizeof(XF86ConfInputrefRec));
|
||||
XF86ConfInputrefPtr iptr = calloc(1, sizeof(XF86ConfInputrefRec));
|
||||
iptr->list.next = NULL;
|
||||
iptr->iref_option_lst = NULL;
|
||||
iptr->iref_inputdev_str = XNFstrdup("Keyboard0");
|
||||
|
@ -367,10 +363,9 @@ configureLayoutSection(void)
|
|||
}
|
||||
|
||||
for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
|
||||
XF86ConfAdjacencyPtr aptr;
|
||||
char *tmp;
|
||||
|
||||
aptr = malloc(sizeof(XF86ConfAdjacencyRec));
|
||||
XF86ConfAdjacencyPtr aptr = calloc(1, sizeof(XF86ConfAdjacencyRec));
|
||||
aptr->list.next = NULL;
|
||||
aptr->adj_x = 0;
|
||||
aptr->adj_y = 0;
|
||||
|
|
|
@ -482,7 +482,7 @@ AddEdge(xf86EdgePtr edge,
|
|||
}
|
||||
|
||||
if (!pEdge) {
|
||||
if (!(pNew = malloc(sizeof(xf86EdgeRec))))
|
||||
if (!(pNew = calloc(1, sizeof(xf86EdgeRec))))
|
||||
break;
|
||||
|
||||
pNew->screen = screen;
|
||||
|
@ -500,7 +500,7 @@ AddEdge(xf86EdgePtr edge,
|
|||
break;
|
||||
}
|
||||
else if (min < pEdge->start) {
|
||||
if (!(pNew = malloc(sizeof(xf86EdgeRec))))
|
||||
if (!(pNew = calloc(1, sizeof(xf86EdgeRec))))
|
||||
break;
|
||||
|
||||
pNew->screen = screen;
|
||||
|
|
|
@ -146,7 +146,7 @@ DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
|
|||
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (!pScreenPriv) {
|
||||
if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec))))
|
||||
if (!(pScreenPriv = calloc(1, sizeof(DGAScreenRec))))
|
||||
return FALSE;
|
||||
dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
|
@ -400,7 +400,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
|
|||
else
|
||||
return BadValue;
|
||||
|
||||
if (!(device = (DGADevicePtr) malloc(sizeof(DGADeviceRec))))
|
||||
if (!(device = calloc(1, sizeof(DGADeviceRec))))
|
||||
return BadAlloc;
|
||||
|
||||
if (!pScreenPriv->current) {
|
||||
|
@ -664,7 +664,7 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
|
|||
|
||||
pMode = &(pScreenPriv->modes[mode - 1]);
|
||||
|
||||
if (!(pVisual = malloc(sizeof(VisualRec))))
|
||||
if (!(pVisual = calloc(1, sizeof(VisualRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pVisual->vid = FakeClientID(0);
|
||||
|
@ -698,7 +698,7 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
|
|||
pVisual->offsetBlue = BitsClear(pVisual->blueMask);
|
||||
}
|
||||
|
||||
if (!(fvlp = malloc(sizeof(FakedVisualList)))) {
|
||||
if (!(fvlp = calloc(1, sizeof(FakedVisualList)))) {
|
||||
free(pVisual);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
@ -1682,7 +1682,7 @@ ProcXDGASetClientVersion(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
|
||||
if ((pPriv = DGA_GETPRIV(client)) == NULL) {
|
||||
pPriv = malloc(sizeof(DGAPrivRec));
|
||||
pPriv = calloc(1, sizeof(DGAPrivRec));
|
||||
/* XXX Need to look into freeing this */
|
||||
if (!pPriv)
|
||||
return BadAlloc;
|
||||
|
|
|
@ -898,13 +898,13 @@ xf86NameCmp(const char *s1, const char *s2)
|
|||
char *
|
||||
xf86NormalizeName(const char *s)
|
||||
{
|
||||
char *ret, *q;
|
||||
char *q;
|
||||
const char *p;
|
||||
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
||||
ret = malloc(strlen(s) + 1);
|
||||
char *ret = calloc(1, strlen(s) + 1);
|
||||
for (p = s, q = ret; *p != 0; p++) {
|
||||
switch (*p) {
|
||||
case '_':
|
||||
|
|
|
@ -406,7 +406,6 @@ Bool
|
|||
xf86RandRInit(ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr rp;
|
||||
XF86RandRInfoPtr randrp;
|
||||
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
|
||||
|
||||
#ifdef XINERAMA
|
||||
|
@ -420,7 +419,7 @@ xf86RandRInit(ScreenPtr pScreen)
|
|||
if (!dixRegisterPrivateKey(&xf86RandRKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
randrp = malloc(sizeof(XF86RandRInfoRec));
|
||||
XF86RandRInfoPtr randrp = calloc(1, sizeof(XF86RandRInfoRec));
|
||||
if (!randrp)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ xf86VGAarbiterWrapFunctions(void)
|
|||
if (!dixRegisterPrivateKey(&VGAarbiterScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!(pScreenPriv = malloc(sizeof(VGAarbiterScreenRec))))
|
||||
if (!(pScreenPriv = calloc(1, sizeof(VGAarbiterScreenRec))))
|
||||
return FALSE;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv);
|
||||
|
|
|
@ -168,7 +168,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(pScreenPriv = malloc(sizeof(CMapScreenRec)))) {
|
||||
if (!(pScreenPriv = calloc(1, sizeof(CMapScreenRec)))) {
|
||||
free(gamma);
|
||||
free(indices);
|
||||
return FALSE;
|
||||
|
@ -264,7 +264,6 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
|
|||
(CMapScreenPtr) dixLookupPrivate(&pmap->pScreen->devPrivates,
|
||||
CMapScreenKey);
|
||||
CMapColormapPtr pColPriv;
|
||||
CMapLinkPtr pLink;
|
||||
int numColors;
|
||||
LOCO *colors;
|
||||
|
||||
|
@ -276,7 +275,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
|
|||
if (!(colors = xallocarray(numColors, sizeof(LOCO))))
|
||||
return FALSE;
|
||||
|
||||
if (!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
|
||||
if (!(pColPriv = calloc(1, sizeof(CMapColormapRec)))) {
|
||||
free(colors);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -289,7 +288,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
|
|||
pColPriv->overscan = -1;
|
||||
|
||||
/* add map to list */
|
||||
pLink = malloc(sizeof(CMapLink));
|
||||
CMapLinkPtr pLink = calloc(1, sizeof(CMapLink));
|
||||
if (pLink) {
|
||||
pLink->cmap = pmap;
|
||||
pLink->next = pScreenPriv->maps;
|
||||
|
|
|
@ -371,7 +371,7 @@ AllocateArea(FBManagerPtr offman,
|
|||
if (((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
|
||||
continue;
|
||||
|
||||
link = malloc(sizeof(FBLink));
|
||||
link = calloc(1, sizeof(FBLink));
|
||||
if (!link)
|
||||
return NULL;
|
||||
|
||||
|
@ -829,7 +829,6 @@ AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData)
|
|||
{
|
||||
ScreenPtr pScreen = offman->pScreen;
|
||||
FBLinearLinkPtr linear = NULL;
|
||||
FBLinearLinkPtr newlink = NULL;
|
||||
int offset, end;
|
||||
|
||||
if (size <= 0)
|
||||
|
@ -857,7 +856,7 @@ AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData)
|
|||
|
||||
/* break left */
|
||||
if (offset > linear->linear.offset) {
|
||||
newlink = malloc(sizeof(FBLinearLink));
|
||||
FBLinearLinkPtr newlink = calloc(1, sizeof(FBLinearLink));
|
||||
if (!newlink)
|
||||
return NULL;
|
||||
newlink->area = NULL;
|
||||
|
@ -873,7 +872,7 @@ AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData)
|
|||
|
||||
/* break right */
|
||||
if (size < linear->linear.size) {
|
||||
newlink = malloc(sizeof(FBLinearLink));
|
||||
FBLinearLinkPtr newlink = calloc(1, sizeof(FBLinearLink));
|
||||
if (!newlink)
|
||||
return NULL;
|
||||
newlink->area = NULL;
|
||||
|
@ -923,7 +922,7 @@ localAllocateOffscreenLinear(ScreenPtr pScreen,
|
|||
|
||||
DebugF("NOPE, ALLOCATING AREA\n");
|
||||
|
||||
if (!(link = malloc(sizeof(FBLinearLink))))
|
||||
if (!(link = calloc(1, sizeof(FBLinearLink))))
|
||||
return NULL;
|
||||
|
||||
/* No linear available, so try and pinch some from the XY areas */
|
||||
|
@ -1309,7 +1308,6 @@ xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity)
|
|||
Bool
|
||||
xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion)
|
||||
{
|
||||
FBManagerPtr offman;
|
||||
|
||||
if (RegionNil(FullRegion))
|
||||
return FALSE;
|
||||
|
@ -1320,7 +1318,7 @@ xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion)
|
|||
if (!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
|
||||
return FALSE;
|
||||
|
||||
offman = malloc(sizeof(FBManager));
|
||||
FBManagerPtr offman = calloc(1, sizeof(FBManager));
|
||||
if (!offman)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1362,7 +1360,7 @@ xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size)
|
|||
|
||||
offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
|
||||
xf86FBScreenKey);
|
||||
offman->LinearAreas = malloc(sizeof(FBLinearLink));
|
||||
offman->LinearAreas = calloc(1, sizeof(FBLinearLink));
|
||||
if (!offman->LinearAreas)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -1358,7 +1358,7 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
|
|||
}
|
||||
if (vendor == match_vendor && chip == match_chip) {
|
||||
tmpMatch =
|
||||
(char *) malloc(sizeof(char) *
|
||||
(char *) calloc(1, sizeof(char) *
|
||||
strlen(direntry->d_name) - 3);
|
||||
if (!tmpMatch) {
|
||||
LogMessageVerb(X_ERROR, 1,
|
||||
|
|
|
@ -86,7 +86,7 @@ xf86SbusProbe(void)
|
|||
char fbDevName[32];
|
||||
sbusDevicePtr psdp, *psdpp;
|
||||
|
||||
xf86SbusInfo = malloc(sizeof(psdp));
|
||||
xf86SbusInfo = calloc(1, sizeof(psdp));
|
||||
*xf86SbusInfo = NULL;
|
||||
for (i = 0; i < 32; i++) {
|
||||
snprintf(fbDevName, sizeof(fbDevName), "/dev/fb%d", i);
|
||||
|
|
|
@ -245,7 +245,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
|
|||
|
||||
PortResource = XvGetRTPort();
|
||||
|
||||
ScreenPriv = malloc(sizeof(XF86XVScreenRec));
|
||||
ScreenPriv = calloc(1, sizeof(XF86XVScreenRec));
|
||||
dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv);
|
||||
|
||||
if (!ScreenPriv)
|
||||
|
|
|
@ -163,7 +163,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
|
||||
if (!(pScreenPriv = calloc(1, sizeof(xf86XvMCScreenRec)))) {
|
||||
free(pAdapt);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -64,12 +64,10 @@
|
|||
XISBuffer *
|
||||
XisbNew(int fd, ssize_t size)
|
||||
{
|
||||
XISBuffer *b;
|
||||
|
||||
b = malloc(sizeof(XISBuffer));
|
||||
XISBuffer *b = calloc(1, sizeof(XISBuffer));
|
||||
if (!b)
|
||||
return NULL;
|
||||
b->buf = malloc((sizeof(unsigned char) * size));
|
||||
b->buf = calloc(sizeof(unsigned char), size);
|
||||
if (!b->buf) {
|
||||
free(b);
|
||||
return NULL;
|
||||
|
|
|
@ -90,7 +90,7 @@ find_header(unsigned char *block)
|
|||
static unsigned char *
|
||||
resort(unsigned char *s_block)
|
||||
{
|
||||
unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
|
||||
unsigned char *d_ptr, *d_end, *s_ptr, *s_end;
|
||||
unsigned char tmp;
|
||||
|
||||
s_ptr = find_header(s_block);
|
||||
|
@ -98,7 +98,7 @@ resort(unsigned char *s_block)
|
|||
return NULL;
|
||||
s_end = s_block + EDID1_LEN;
|
||||
|
||||
d_new = malloc(EDID1_LEN);
|
||||
unsigned char *d_new = calloc(1, EDID1_LEN);
|
||||
if (!d_new)
|
||||
return NULL;
|
||||
d_end = d_new + EDID1_LEN;
|
||||
|
@ -186,7 +186,7 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn,
|
|||
int count = NUM;
|
||||
unsigned int *ptr, *xp;
|
||||
|
||||
ptr = xp = malloc(sizeof(int) * NUM);
|
||||
ptr = xp = calloc(NUM, sizeof(int));
|
||||
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
@ -413,9 +413,7 @@ xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete)
|
|||
|
||||
/* Default DDC and DDC2 to enabled. */
|
||||
Bool noddc = FALSE, noddc2 = FALSE;
|
||||
OptionInfoPtr options;
|
||||
|
||||
options = malloc(sizeof(DDCOptions));
|
||||
OptionInfoPtr options = calloc(1, sizeof(DDCOptions));
|
||||
if (!options)
|
||||
return NULL;
|
||||
memcpy(options, DDCOptions, sizeof(DDCOptions));
|
||||
|
|
|
@ -1285,7 +1285,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
|
|||
}
|
||||
else {
|
||||
/* allocate a DRI Window Private record */
|
||||
if (!(pDRIDrawablePriv = malloc(sizeof(DRIDrawablePrivRec)))) {
|
||||
if (!(pDRIDrawablePriv = calloc(1, sizeof(DRIDrawablePrivRec)))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -235,12 +235,11 @@ static DRI2DrawablePtr
|
|||
DRI2AllocateDrawable(DrawablePtr pDraw)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
||||
DRI2DrawablePtr pPriv;
|
||||
CARD64 ust;
|
||||
WindowPtr pWin;
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
pPriv = malloc(sizeof *pPriv);
|
||||
DRI2DrawablePtr pPriv = calloc(1, sizeof *pPriv);
|
||||
if (pPriv == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -327,9 +326,7 @@ static int
|
|||
DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
|
||||
DRI2InvalidateProcPtr invalidate, void *priv)
|
||||
{
|
||||
DRI2DrawableRefPtr ref;
|
||||
|
||||
ref = malloc(sizeof *ref);
|
||||
DRI2DrawableRefPtr ref = calloc(1, sizeof *ref);
|
||||
if (ref == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ struct ms_dri2_resource {
|
|||
static struct ms_dri2_resource *
|
||||
ms_get_resource(XID id, RESTYPE type)
|
||||
{
|
||||
struct ms_dri2_resource *resource;
|
||||
void *ptr;
|
||||
|
||||
ptr = NULL;
|
||||
|
@ -96,7 +95,7 @@ ms_get_resource(XID id, RESTYPE type)
|
|||
if (ptr)
|
||||
return ptr;
|
||||
|
||||
resource = malloc(sizeof(*resource));
|
||||
struct ms_dri2_resource *resource = calloc(1, sizeof(*resource));
|
||||
if (resource == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -1327,7 +1327,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
|
|||
|
||||
/* Process the options */
|
||||
xf86CollectOptions(pScrn, NULL);
|
||||
if (!(ms->drmmode.Options = malloc(sizeof(Options))))
|
||||
if (!(ms->drmmode.Options = calloc(1, sizeof(Options))))
|
||||
return FALSE;
|
||||
memcpy(ms->drmmode.Options, Options, sizeof(Options));
|
||||
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->drmmode.Options);
|
||||
|
|
|
@ -410,7 +410,7 @@ drmmode_prop_info_copy(drmmode_prop_info_ptr dst,
|
|||
continue;
|
||||
|
||||
dst[i].enum_values =
|
||||
malloc(src[i].num_enum_values *
|
||||
calloc(src[i].num_enum_values,
|
||||
sizeof(*dst[i].enum_values));
|
||||
if (!dst[i].enum_values)
|
||||
goto err;
|
||||
|
@ -4121,7 +4121,7 @@ drmmode_crtc_upgrade_lut(xf86CrtcPtr crtc, int num)
|
|||
|
||||
if (size != crtc->gamma_size) {
|
||||
ScrnInfoPtr pScrn = crtc->scrn;
|
||||
uint16_t *gamma = malloc(3 * size * sizeof(uint16_t));
|
||||
uint16_t *gamma = calloc(3 * size, sizeof(uint16_t));
|
||||
|
||||
if (gamma) {
|
||||
free(crtc->gamma_red);
|
||||
|
|
|
@ -207,7 +207,7 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
|
|||
configOptions = pEnt->device->options;
|
||||
|
||||
if (configOptions) {
|
||||
if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
|
||||
if (!(options = (OptionInfoPtr) calloc(1, sizeof(INT10Options))))
|
||||
return NULL;
|
||||
|
||||
(void) memcpy(options, INT10Options, sizeof(INT10Options));
|
||||
|
|
|
@ -505,8 +505,6 @@ VBEGetVBEMode(vbeInfoPtr pVbe, int *mode)
|
|||
VbeModeInfoBlock *
|
||||
VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
|
||||
{
|
||||
VbeModeInfoBlock *block = NULL;
|
||||
|
||||
memset(pVbe->memory, 0, sizeof(VbeModeInfoBlock));
|
||||
|
||||
/*
|
||||
|
@ -530,7 +528,7 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
|
|||
if (R16(pVbe->pInt10->ax) != 0x4f)
|
||||
return NULL;
|
||||
|
||||
block = malloc(sizeof(VbeModeInfoBlock));
|
||||
VbeModeInfoBlock *block = calloc(1, sizeof(VbeModeInfoBlock));
|
||||
if (block)
|
||||
memcpy(block, pVbe->memory, sizeof(*block));
|
||||
|
||||
|
@ -834,7 +832,6 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
|
|||
VBEpmi *
|
||||
VBEGetVBEpmi(vbeInfoPtr pVbe)
|
||||
{
|
||||
VBEpmi *pmi;
|
||||
|
||||
/*
|
||||
Input:
|
||||
|
@ -859,7 +856,7 @@ VBEGetVBEpmi(vbeInfoPtr pVbe)
|
|||
if (R16(pVbe->pInt10->ax) != 0x4f)
|
||||
return NULL;
|
||||
|
||||
pmi = malloc(sizeof(VBEpmi));
|
||||
VBEpmi *pmi = calloc(1, sizeof(VBEpmi));
|
||||
pmi->seg_tbl = R16(pVbe->pInt10->es);
|
||||
pmi->tbl_off = R16(pVbe->pInt10->di);
|
||||
pmi->tbl_len = R16(pVbe->pInt10->cx);
|
||||
|
@ -936,7 +933,7 @@ VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
|
|||
vbe_sr->stateMode = -1; /* invalidate */
|
||||
/* don't rely on the memory not being touched */
|
||||
if (vbe_sr->pstate == NULL)
|
||||
vbe_sr->pstate = malloc(vbe_sr->stateSize);
|
||||
vbe_sr->pstate = calloc(1, vbe_sr->stateSize);
|
||||
memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize);
|
||||
}
|
||||
ErrorF("VBESaveRestore done with success\n");
|
||||
|
|
|
@ -142,7 +142,7 @@ InitPathList(const char *path)
|
|||
free(fullpath);
|
||||
return NULL;
|
||||
}
|
||||
list[n] = malloc(len + 1);
|
||||
list[n] = calloc(1, len + 1);
|
||||
if (!list[n]) {
|
||||
FreeStringList(list);
|
||||
free(fullpath);
|
||||
|
@ -398,7 +398,7 @@ LoaderListDir(const char *subdir, const char **patternlist)
|
|||
closedir(d);
|
||||
goto bail;
|
||||
}
|
||||
listing[n] = malloc(len + 1);
|
||||
listing[n] = calloc(1, len + 1);
|
||||
if (!listing[n]) {
|
||||
FreeStringList(listing);
|
||||
closedir(d);
|
||||
|
@ -723,7 +723,7 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq,
|
|||
|
||||
pathlist = defaultPathList;
|
||||
if (!pathlist) {
|
||||
/* This could be a malloc failure too */
|
||||
/* This could be a calloc failure too */
|
||||
if (errmaj)
|
||||
*errmaj = LDR_BADUSAGE;
|
||||
goto LoadModule_fail;
|
||||
|
@ -962,7 +962,6 @@ LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin)
|
|||
static char *
|
||||
LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
|
||||
{
|
||||
char *str;
|
||||
const char *s;
|
||||
int len;
|
||||
PatternPtr p;
|
||||
|
@ -979,7 +978,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
|
|||
for (p = patterns; p->pattern; p++)
|
||||
if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
|
||||
len = match[1].rm_eo - match[1].rm_so;
|
||||
str = malloc(len + 1);
|
||||
char *str = calloc(1, len + 1);
|
||||
if (!str)
|
||||
return NULL;
|
||||
strncpy(str, s + match[1].rm_so, len);
|
||||
|
|
|
@ -649,7 +649,7 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
|
|||
if (!cursor_info)
|
||||
return FALSE;
|
||||
|
||||
xf86_config->cursor_image = malloc(max_width * max_height * 4);
|
||||
xf86_config->cursor_image = calloc(max_width * max_height, 4);
|
||||
|
||||
if (!xf86_config->cursor_image) {
|
||||
xf86DestroyCursorInfoRec(cursor_info);
|
||||
|
|
|
@ -847,7 +847,6 @@ Bool
|
|||
xf86RandR12Init(ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr rp;
|
||||
XF86RandRInfoPtr randrp;
|
||||
|
||||
#ifdef XINERAMA
|
||||
/* XXX disable RandR when using Xinerama */
|
||||
|
@ -865,7 +864,7 @@ xf86RandR12Init(ScreenPtr pScreen)
|
|||
if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
randrp = malloc(sizeof(XF86RandRInfoRec));
|
||||
XF86RandRInfoPtr randrp = calloc(1, sizeof(XF86RandRInfoRec));
|
||||
if (!randrp)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ xf86CrtcRotate(xf86CrtcPtr crtc)
|
|||
#ifdef RANDR_12_INTERFACE
|
||||
if (transform) {
|
||||
if (transform->nparams) {
|
||||
new_params = malloc(transform->nparams * sizeof(xFixed));
|
||||
new_params = calloc(transform->nparams, sizeof(xFixed));
|
||||
if (new_params) {
|
||||
memcpy(new_params, transform->params,
|
||||
transform->nparams * sizeof(xFixed));
|
||||
|
|
|
@ -213,7 +213,7 @@ sparcPromInit(void)
|
|||
promFd = open("/dev/openprom", O_RDONLY, 0);
|
||||
if (promFd == -1)
|
||||
return -1;
|
||||
promOpio = (struct openpromio *) malloc(4096);
|
||||
promOpio = (struct openpromio *) calloc(1, 4096);
|
||||
if (!promOpio) {
|
||||
sparcPromClose();
|
||||
return -1;
|
||||
|
@ -535,11 +535,9 @@ promWalkNode2Pathname(char *path, int parent, int node, int searchNode,
|
|||
char *
|
||||
sparcPromNode2Pathname(sbusPromNodePtr pnode)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if (!pnode->node)
|
||||
return NULL;
|
||||
ret = malloc(4096);
|
||||
char *ret = calloc(1, 4096);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if (promWalkNode2Pathname
|
||||
|
@ -609,10 +607,10 @@ int
|
|||
sparcPromPathname2Node(const char *pathName)
|
||||
{
|
||||
int i;
|
||||
char *name, *regstr, *p;
|
||||
char *regstr, *p;
|
||||
|
||||
i = strlen(pathName);
|
||||
name = malloc(i + 2);
|
||||
char *name = calloc(1, i + 2);
|
||||
if (!name)
|
||||
return 0;
|
||||
strcpy(name, pathName);
|
||||
|
|
|
@ -121,7 +121,7 @@ xf86parseFilesSection(void)
|
|||
l = FALSE;
|
||||
str = xf86_lex_val.str;
|
||||
if (ptr->file_modulepath == NULL) {
|
||||
ptr->file_modulepath = malloc(1);
|
||||
ptr->file_modulepath = calloc(1, 1);
|
||||
ptr->file_modulepath[0] = '\0';
|
||||
k = strlen(str) + 1;
|
||||
}
|
||||
|
|
|
@ -155,9 +155,7 @@ enum MatchType {
|
|||
static void
|
||||
add_group_entry(struct xorg_list *head, char **values, enum MatchType type)
|
||||
{
|
||||
xf86MatchGroup *group;
|
||||
|
||||
group = malloc(sizeof(*group));
|
||||
xf86MatchGroup *group = calloc(1, sizeof(xf86MatchGroup));
|
||||
if (group) {
|
||||
group->is_negated = (type == MATCH_NEGATED);
|
||||
group->values = values;
|
||||
|
|
|
@ -78,9 +78,7 @@ xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
|
|||
static void
|
||||
add_group_entry(struct xorg_list *head, char **values)
|
||||
{
|
||||
xf86MatchGroup *group;
|
||||
|
||||
group = malloc(sizeof(*group));
|
||||
xf86MatchGroup *group = calloc(1, sizeof(xf86MatchGroup));
|
||||
if (group) {
|
||||
group->values = values;
|
||||
xorg_list_add(&group->entry, head);
|
||||
|
|
|
@ -118,20 +118,20 @@ xf86getNextLine(void)
|
|||
|
||||
/*
|
||||
* reallocate the string if it was grown last time (i.e., is no
|
||||
* longer CONFIG_BUF_LEN); we malloc the new strings first, so
|
||||
* that if either of the mallocs fail, we can fall back on the
|
||||
* longer CONFIG_BUF_LEN); we calloc the new strings first, so
|
||||
* that if either of the callocs fail, we can fall back on the
|
||||
* existing buffer allocations
|
||||
*/
|
||||
|
||||
if (configBufLen != CONFIG_BUF_LEN) {
|
||||
|
||||
tmpConfigBuf = malloc(CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
|
||||
tmpConfigBuf = calloc(1, CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = calloc(1, CONFIG_BUF_LEN);
|
||||
|
||||
if (!tmpConfigBuf || !tmpConfigRBuf) {
|
||||
|
||||
/*
|
||||
* at least one of the mallocs failed; keep the old buffers
|
||||
* at least one of the callocs failed; keep the old buffers
|
||||
* and free any partial allocations
|
||||
*/
|
||||
|
||||
|
@ -142,7 +142,7 @@ xf86getNextLine(void)
|
|||
else {
|
||||
|
||||
/*
|
||||
* malloc succeeded; free the old buffers and use the new
|
||||
* calloc succeeded; free the old buffers and use the new
|
||||
* buffers
|
||||
*/
|
||||
|
||||
|
@ -393,7 +393,7 @@ xf86getToken(const xf86ConfigSymTabRec * tab)
|
|||
}
|
||||
while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
|
||||
configRBuf[i] = '\0';
|
||||
xf86_lex_val.str = malloc(strlen(configRBuf) + 1);
|
||||
xf86_lex_val.str = calloc(1, strlen(configRBuf) + 1);
|
||||
strcpy(xf86_lex_val.str, configRBuf); /* private copy ! */
|
||||
return STRING;
|
||||
}
|
||||
|
@ -569,7 +569,6 @@ static char *
|
|||
DoSubstitution(const char *template, const char *cmdline, const char *projroot,
|
||||
int *cmdlineUsed, int *envUsed, const char *XConfigFile)
|
||||
{
|
||||
char *result;
|
||||
int i, l;
|
||||
static const char *env = NULL;
|
||||
static char *hostname = NULL;
|
||||
|
@ -582,7 +581,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
|
|||
if (envUsed)
|
||||
*envUsed = 0;
|
||||
|
||||
result = malloc(PATH_MAX + 1);
|
||||
char *result = calloc(1, PATH_MAX + 1);
|
||||
l = 0;
|
||||
for (i = 0; template[i]; i++) {
|
||||
if (template[i] != '%') {
|
||||
|
@ -623,7 +622,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
|
|||
break;
|
||||
case 'H':
|
||||
if (!hostname) {
|
||||
if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
|
||||
if ((hostname = calloc(1, MAXHOSTNAMELEN + 1))) {
|
||||
if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
|
||||
hostname[MAXHOSTNAMELEN] = '\0';
|
||||
}
|
||||
|
@ -769,7 +768,6 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
|
|||
Bool warnOnce = FALSE;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
char *path;
|
||||
FILE *file;
|
||||
|
||||
if (numFiles >= CONFIG_MAX_FILES) {
|
||||
|
@ -780,7 +778,7 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
|
|||
continue;
|
||||
}
|
||||
|
||||
path = malloc(PATH_MAX + 1);
|
||||
char *path = calloc(1, PATH_MAX + 1);
|
||||
snprintf(path, PATH_MAX + 1, "%s/%s", dirpath, list[i]->d_name);
|
||||
file = fopen(path, "r");
|
||||
if (!file) {
|
||||
|
@ -857,8 +855,8 @@ xf86initConfigFiles(void)
|
|||
configLineNo = 0;
|
||||
pushToken = LOCK_TOKEN;
|
||||
|
||||
configBuf = malloc(CONFIG_BUF_LEN);
|
||||
configRBuf = malloc(CONFIG_BUF_LEN);
|
||||
configBuf = calloc(1, CONFIG_BUF_LEN);
|
||||
configRBuf = calloc(1, CONFIG_BUF_LEN);
|
||||
configBuf[0] = '\0'; /* sanity ... */
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ ShadowFBInit2(ScreenPtr pScreen,
|
|||
if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec))))
|
||||
if (!(pPriv = (ShadowScreenPtr) calloc(1, sizeof(ShadowScreenRec))))
|
||||
return FALSE;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, pPriv);
|
||||
|
|
|
@ -294,7 +294,7 @@ vert_refresh(int h_pixels, int v_lines, float freq, int interlaced, int margins)
|
|||
float h_front_porch;
|
||||
float v_odd_front_porch_lines;
|
||||
|
||||
mode *m = (mode *) malloc(sizeof(mode));
|
||||
mode *m = (mode *) calloc(1, sizeof(mode));
|
||||
|
||||
/* 1. In order to give correct results, the number of horizontal
|
||||
* pixels requested is first processed to ensure that it is divisible
|
||||
|
|
|
@ -952,21 +952,21 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
|
|||
hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
|
||||
|
||||
#if SAVE_FONT1
|
||||
if (hwp->FontInfo1 || (hwp->FontInfo1 = malloc(FONT_AMOUNT))) {
|
||||
if (hwp->FontInfo1 || (hwp->FontInfo1 = calloc(1, FONT_AMOUNT))) {
|
||||
hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
|
||||
hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
|
||||
slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
|
||||
}
|
||||
#endif /* SAVE_FONT1 */
|
||||
#if SAVE_FONT2
|
||||
if (hwp->FontInfo2 || (hwp->FontInfo2 = malloc(FONT_AMOUNT))) {
|
||||
if (hwp->FontInfo2 || (hwp->FontInfo2 = calloc(1, FONT_AMOUNT))) {
|
||||
hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
|
||||
hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
|
||||
slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
|
||||
}
|
||||
#endif /* SAVE_FONT2 */
|
||||
#if SAVE_TEXT
|
||||
if (hwp->TextInfo || (hwp->TextInfo = malloc(2 * TEXT_AMOUNT))) {
|
||||
if (hwp->TextInfo || (hwp->TextInfo = calloc(2, TEXT_AMOUNT))) {
|
||||
hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
|
||||
hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
|
||||
slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
|
||||
|
|
|
@ -37,7 +37,6 @@ int xnestFontPrivateIndex;
|
|||
Bool
|
||||
xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
|
||||
{
|
||||
void *priv;
|
||||
Atom name_atom, value_atom;
|
||||
int nprops;
|
||||
FontPropPtr props;
|
||||
|
@ -66,7 +65,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
|
|||
if (!name)
|
||||
return FALSE;
|
||||
|
||||
priv = (void *) malloc(sizeof(xnestPrivFont));
|
||||
void *priv = calloc(1, sizeof(xnestPrivFont));
|
||||
xfont2_font_set_private(pFont, xnestFontPrivateIndex, priv);
|
||||
|
||||
xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
|
||||
|
|
|
@ -167,10 +167,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
visuals = xallocarray(xnestNumVisuals, sizeof(VisualRec));
|
||||
numVisuals = 0;
|
||||
|
||||
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
|
||||
depths = calloc(MAXDEPTH, sizeof(DepthRec));
|
||||
depths[0].depth = 1;
|
||||
depths[0].numVids = 0;
|
||||
depths[0].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
|
||||
depths[0].vids = calloc(MAXVISUALSPERDEPTH, sizeof(VisualID));
|
||||
numDepths = 1;
|
||||
|
||||
for (i = 0; i < xnestNumVisuals; i++) {
|
||||
|
@ -217,8 +217,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
depthIndex = numDepths;
|
||||
depths[depthIndex].depth = xnestVisuals[i].depth;
|
||||
depths[depthIndex].numVids = 0;
|
||||
depths[depthIndex].vids =
|
||||
(VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
|
||||
depths[depthIndex].vids = calloc(MAXVISUALSPERDEPTH, sizeof(VisualID));
|
||||
numDepths++;
|
||||
}
|
||||
if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
|
||||
|
|
|
@ -455,7 +455,7 @@ xwl_screen_add_drm_lease_device(struct xwl_screen *xwl_screen, uint32_t id)
|
|||
{
|
||||
struct wp_drm_lease_device_v1 *lease_device = wl_registry_bind(
|
||||
xwl_screen->registry, id, &wp_drm_lease_device_v1_interface, 1);
|
||||
struct xwl_drm_lease_device *device_data = malloc(sizeof(struct xwl_drm_lease_device));
|
||||
struct xwl_drm_lease_device *device_data = calloc(1, sizeof(struct xwl_drm_lease_device));
|
||||
|
||||
device_data->drm_lease_device = lease_device;
|
||||
device_data->xwl_screen = xwl_screen;
|
||||
|
|
|
@ -166,7 +166,6 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo,
|
|||
Bool implicit_modifier)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
struct xwl_pixmap *xwl_pixmap;
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
#ifdef GBM_BO_FD_FOR_PLANE
|
||||
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
|
||||
|
@ -218,7 +217,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo,
|
|||
for (plane = 0; plane < num_planes; plane++) fds[plane] = -1;
|
||||
#endif
|
||||
|
||||
xwl_pixmap = calloc(1, sizeof(*xwl_pixmap));
|
||||
struct xwl_pixmap *xwl_pixmap = calloc(1, sizeof(struct xwl_pixmap));
|
||||
if (xwl_pixmap == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -717,7 +716,6 @@ xwl_dri3_open_client(ClientPtr client,
|
|||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
|
||||
struct xwl_auth_state *state;
|
||||
drm_magic_t magic;
|
||||
int fd;
|
||||
|
||||
|
@ -729,7 +727,7 @@ xwl_dri3_open_client(ClientPtr client,
|
|||
return Success;
|
||||
}
|
||||
|
||||
state = malloc(sizeof *state);
|
||||
struct xwl_auth_state *state = calloc(1, sizeof(struct xwl_auth_state));
|
||||
if (state == NULL) {
|
||||
close(fd);
|
||||
return BadAlloc;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue