Unverified Commit 20029dbc authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/happyvalgrind' into 3.6.x

Fixes ArcticaProject/nx-libs#325. Fixes ArcticaProject/nx-libs#326. Attribute GH PR #360: https://github.com/ArcticaProject/nx-libs/pull/360
parents 9d41e84e 3e315cd1
...@@ -660,6 +660,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) ...@@ -660,6 +660,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
for(i = 1; i < PanoramiXNumScreens; i++) for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
memset(&xgi, 0, sizeof(xShmGetImageReply));
xgi.visual = wVisual(((WindowPtr)pDraw)); xgi.visual = wVisual(((WindowPtr)pDraw));
xgi.type = X_Reply; xgi.type = X_Reply;
xgi.length = 0; xgi.length = 0;
...@@ -913,6 +914,7 @@ ProcShmPutImage(client) ...@@ -913,6 +914,7 @@ ProcShmPutImage(client)
{ {
xShmCompletionEvent ev; xShmCompletionEvent ev;
memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode; ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable; ev.drawable = stuff->drawable;
ev.minorEvent = X_ShmPutImage; ev.minorEvent = X_ShmPutImage;
...@@ -947,6 +949,9 @@ ProcShmGetImage(client) ...@@ -947,6 +949,9 @@ ProcShmGetImage(client)
} }
VERIFY_DRAWABLE(pDraw, stuff->drawable, client); VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
memset(&xgi, 0, sizeof(xShmGetImageReply));
if (pDraw->type == DRAWABLE_WINDOW) if (pDraw->type == DRAWABLE_WINDOW)
{ {
if( /* check for being viewable */ if( /* check for being viewable */
......
...@@ -354,6 +354,7 @@ ProcXF86BigfontQueryVersion( ...@@ -354,6 +354,7 @@ ProcXF86BigfontQueryVersion(
xXF86BigfontQueryVersionReply reply; xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq); REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
memset(&reply, 0, sizeof(xXF86BigfontQueryVersionReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
...@@ -638,7 +639,7 @@ ProcXF86BigfontQueryFont( ...@@ -638,7 +639,7 @@ ProcXF86BigfontQueryFont(
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16) + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0); : 0);
xXF86BigfontQueryFontReply* reply = xXF86BigfontQueryFontReply* reply =
(xXF86BigfontQueryFontReply *) ALLOCATE_LOCAL(rlength); (xXF86BigfontQueryFontReply *) calloc(1, rlength);
char* p; char* p;
if (!reply) { if (!reply) {
if (nCharInfos > 0) { if (nCharInfos > 0) {
...@@ -718,7 +719,7 @@ ProcXF86BigfontQueryFont( ...@@ -718,7 +719,7 @@ ProcXF86BigfontQueryFont(
} }
} }
WriteToClient(client, rlength, reply); WriteToClient(client, rlength, reply);
DEALLOCATE_LOCAL(reply); free(reply);
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex); if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI); if (!pDesc) DEALLOCATE_LOCAL(pCI);
......
...@@ -136,6 +136,8 @@ ProcDamageQueryVersion(ClientPtr client) ...@@ -136,6 +136,8 @@ ProcDamageQueryVersion(ClientPtr client)
REQUEST(xDamageQueryVersionReq); REQUEST(xDamageQueryVersionReq);
REQUEST_SIZE_MATCH(xDamageQueryVersionReq); REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
memset(&rep, 0, sizeof(xDamageQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
......
...@@ -80,7 +80,7 @@ _AddInputDevice(DeviceProc deviceProc, Bool autoStart) ...@@ -80,7 +80,7 @@ _AddInputDevice(DeviceProc deviceProc, Bool autoStart)
if (inputInfo.numDevices >= MAX_DEVICES) if (inputInfo.numDevices >= MAX_DEVICES)
return (DeviceIntPtr)NULL; return (DeviceIntPtr)NULL;
dev = (DeviceIntPtr) malloc(sizeof(DeviceIntRec)); dev = (DeviceIntPtr) calloc(1, sizeof(DeviceIntRec));
if (!dev) if (!dev)
return (DeviceIntPtr)NULL; return (DeviceIntPtr)NULL;
dev->name = (char *)NULL; dev->name = (char *)NULL;
...@@ -498,10 +498,9 @@ InitModMap(register KeyClassPtr keyc) ...@@ -498,10 +498,9 @@ InitModMap(register KeyClassPtr keyc)
} }
} }
} }
keyc->modifierKeyMap = (KeyCode *)malloc(8*keyc->maxKeysPerModifier); keyc->modifierKeyMap = (KeyCode *)calloc(8, keyc->maxKeysPerModifier);
if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier) if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
return (FALSE); return (FALSE);
bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
keysPerModifier[i] = 0; keysPerModifier[i] = 0;
for (i = 8; i < MAP_LENGTH; i++) for (i = 8; i < MAP_LENGTH; i++)
...@@ -525,7 +524,7 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers ...@@ -525,7 +524,7 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
int i; int i;
register KeyClassPtr keyc; register KeyClassPtr keyc;
keyc = (KeyClassPtr)malloc(sizeof(KeyClassRec)); keyc = (KeyClassPtr)calloc(1, sizeof(KeyClassRec));
if (!keyc) if (!keyc)
return FALSE; return FALSE;
keyc->curKeySyms.map = (KeySym *)NULL; keyc->curKeySyms.map = (KeySym *)NULL;
...@@ -564,7 +563,7 @@ InitButtonClassDeviceStruct(register DeviceIntPtr dev, int numButtons, ...@@ -564,7 +563,7 @@ InitButtonClassDeviceStruct(register DeviceIntPtr dev, int numButtons,
register ButtonClassPtr butc; register ButtonClassPtr butc;
int i; int i;
butc = (ButtonClassPtr)malloc(sizeof(ButtonClassRec)); butc = (ButtonClassPtr)calloc(1, sizeof(ButtonClassRec));
if (!butc) if (!butc)
return FALSE; return FALSE;
butc->numButtons = numButtons; butc->numButtons = numButtons;
...@@ -589,7 +588,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, ...@@ -589,7 +588,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
int i; int i;
register ValuatorClassPtr valc; register ValuatorClassPtr valc;
valc = (ValuatorClassPtr)malloc(sizeof(ValuatorClassRec) + valc = (ValuatorClassPtr)calloc(1, sizeof(ValuatorClassRec) +
numAxes * sizeof(AxisInfo) + numAxes * sizeof(AxisInfo) +
numAxes * sizeof(unsigned int)); numAxes * sizeof(unsigned int));
if (!valc) if (!valc)
...@@ -612,7 +611,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev) ...@@ -612,7 +611,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
{ {
register FocusClassPtr focc; register FocusClassPtr focc;
focc = (FocusClassPtr)malloc(sizeof(FocusClassRec)); focc = (FocusClassPtr)calloc(1, sizeof(FocusClassRec));
if (!focc) if (!focc)
return FALSE; return FALSE;
focc->win = PointerRootWin; focc->win = PointerRootWin;
...@@ -631,7 +630,7 @@ InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc, ...@@ -631,7 +630,7 @@ InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
{ {
register KbdFeedbackPtr feedc; register KbdFeedbackPtr feedc;
feedc = (KbdFeedbackPtr)malloc(sizeof(KbdFeedbackClassRec)); feedc = (KbdFeedbackPtr)calloc(1, sizeof(KbdFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->BellProc = bellProc; feedc->BellProc = bellProc;
...@@ -658,7 +657,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) ...@@ -658,7 +657,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
{ {
register PtrFeedbackPtr feedc; register PtrFeedbackPtr feedc;
feedc = (PtrFeedbackPtr)malloc(sizeof(PtrFeedbackClassRec)); feedc = (PtrFeedbackPtr)calloc(1, sizeof(PtrFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
...@@ -696,7 +695,7 @@ InitStringFeedbackClassDeviceStruct ( ...@@ -696,7 +695,7 @@ InitStringFeedbackClassDeviceStruct (
int i; int i;
register StringFeedbackPtr feedc; register StringFeedbackPtr feedc;
feedc = (StringFeedbackPtr)malloc(sizeof(StringFeedbackClassRec)); feedc = (StringFeedbackPtr)calloc(1, sizeof(StringFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
...@@ -704,9 +703,9 @@ InitStringFeedbackClassDeviceStruct ( ...@@ -704,9 +703,9 @@ InitStringFeedbackClassDeviceStruct (
feedc->ctrl.num_symbols_displayed = 0; feedc->ctrl.num_symbols_displayed = 0;
feedc->ctrl.max_symbols = max_symbols; feedc->ctrl.max_symbols = max_symbols;
feedc->ctrl.symbols_supported = (KeySym *) feedc->ctrl.symbols_supported = (KeySym *)
malloc (sizeof (KeySym) * num_symbols_supported); calloc (num_symbols_supported, sizeof (KeySym));
feedc->ctrl.symbols_displayed = (KeySym *) feedc->ctrl.symbols_displayed = (KeySym *)
malloc (sizeof (KeySym) * max_symbols); calloc (max_symbols, sizeof (KeySym));
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
{ {
if (feedc->ctrl.symbols_supported) if (feedc->ctrl.symbols_supported)
...@@ -734,7 +733,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc, ...@@ -734,7 +733,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
{ {
register BellFeedbackPtr feedc; register BellFeedbackPtr feedc;
feedc = (BellFeedbackPtr)malloc(sizeof(BellFeedbackClassRec)); feedc = (BellFeedbackPtr)calloc(1, sizeof(BellFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
...@@ -753,7 +752,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc) ...@@ -753,7 +752,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
{ {
register LedFeedbackPtr feedc; register LedFeedbackPtr feedc;
feedc = (LedFeedbackPtr)malloc(sizeof(LedFeedbackClassRec)); feedc = (LedFeedbackPtr)calloc(1, sizeof(LedFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
...@@ -774,7 +773,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr ...@@ -774,7 +773,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
{ {
register IntegerFeedbackPtr feedc; register IntegerFeedbackPtr feedc;
feedc = (IntegerFeedbackPtr)malloc(sizeof(IntegerFeedbackClassRec)); feedc = (IntegerFeedbackPtr)calloc(1, sizeof(IntegerFeedbackClassRec));
if (!feedc) if (!feedc)
return FALSE; return FALSE;
feedc->CtrlProc = controlProc; feedc->CtrlProc = controlProc;
......
...@@ -2584,6 +2584,7 @@ ProcAllocColor (register ClientPtr client) ...@@ -2584,6 +2584,7 @@ ProcAllocColor (register ClientPtr client)
RT_COLORMAP, DixWriteAccess); RT_COLORMAP, DixWriteAccess);
if (pmap) if (pmap)
{ {
memset(&acr, 0, sizeof(xAllocColorReply));
acr.type = X_Reply; acr.type = X_Reply;
acr.length = 0; acr.length = 0;
acr.sequenceNumber = client->sequence; acr.sequenceNumber = client->sequence;
...@@ -3766,6 +3767,7 @@ SendConnSetup(register ClientPtr client, char *reason) ...@@ -3766,6 +3767,7 @@ SendConnSetup(register ClientPtr client, char *reason)
{ {
xConnSetupPrefix csp; xConnSetupPrefix csp;
memset(&csp, 0, sizeof(xConnSetupPrefix));
csp.success = xFalse; csp.success = xFalse;
csp.lengthReason = strlen(reason); csp.lengthReason = strlen(reason);
csp.length = (csp.lengthReason + (unsigned)3) >> 2; csp.length = (csp.lengthReason + (unsigned)3) >> 2;
......
...@@ -652,6 +652,7 @@ SyntheticMotion(int x, int y) ...@@ -652,6 +652,7 @@ SyntheticMotion(int x, int y)
y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y; y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
} }
#endif #endif
memset(&xE, 0, sizeof(xEvent));
xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y; xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents) if (syncEvents.playingEvents)
...@@ -1022,7 +1023,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) ...@@ -1022,7 +1023,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
return; return;
} }
} }
qe = (QdEventPtr)malloc(sizeof(QdEventRec) + (count * sizeof(xEvent))); qe = (QdEventPtr)calloc(1, sizeof(QdEventRec) + (count * sizeof(xEvent)));
if (!qe) if (!qe)
return; return;
qe->next = (QdEventPtr)NULL; qe->next = (QdEventPtr)NULL;
...@@ -3100,7 +3101,6 @@ EnterLeaveEvent( ...@@ -3100,7 +3101,6 @@ EnterLeaveEvent(
register WindowPtr pWin, register WindowPtr pWin,
Window child) Window child)
{ {
xEvent event;
register DeviceIntPtr keybd = inputInfo.keyboard; register DeviceIntPtr keybd = inputInfo.keyboard;
WindowPtr focus; WindowPtr focus;
register DeviceIntPtr mouse = inputInfo.pointer; register DeviceIntPtr mouse = inputInfo.pointer;
...@@ -3122,6 +3122,7 @@ EnterLeaveEvent( ...@@ -3122,6 +3122,7 @@ EnterLeaveEvent(
} }
if (mask & filters[type]) if (mask & filters[type])
{ {
xEvent event;
memset(&event, 0, sizeof(xEvent)); memset(&event, 0, sizeof(xEvent));
event.u.u.type = type; event.u.u.type = type;
event.u.u.detail = detail; event.u.u.detail = detail;
...@@ -3244,6 +3245,7 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr ...@@ -3244,6 +3245,7 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr
return; return;
} }
#endif #endif
memset(&event, 0, sizeof(xEvent));
event.u.focus.mode = mode; event.u.focus.mode = mode;
event.u.u.type = type; event.u.u.type = type;
event.u.u.detail = detail; event.u.u.detail = detail;
......
...@@ -101,7 +101,6 @@ ProcRotateProperties(ClientPtr client) ...@@ -101,7 +101,6 @@ ProcRotateProperties(ClientPtr client)
register Atom * atoms; register Atom * atoms;
PropertyPtr * props; /* array of pointer */ PropertyPtr * props; /* array of pointer */
PropertyPtr pProp; PropertyPtr pProp;
xEvent event;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime(); UpdateCurrentTime();
...@@ -169,7 +168,9 @@ found: ...@@ -169,7 +168,9 @@ found:
{ {
/* Generate a PropertyNotify event for each property whose value /* Generate a PropertyNotify event for each property whose value
is changed in the order in which they appear in the request. */ is changed in the order in which they appear in the request. */
xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue; event.u.property.state = PropertyNewValue;
...@@ -259,7 +260,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, ...@@ -259,7 +260,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
Bool sendevent) Bool sendevent)
{ {
PropertyPtr pProp; PropertyPtr pProp;
xEvent event;
int sizeInBytes; int sizeInBytes;
int totalSize; int totalSize;
void * data; void * data;
...@@ -356,6 +356,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, ...@@ -356,6 +356,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
} }
if (sendevent) if (sendevent)
{ {
xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue; event.u.property.state = PropertyNewValue;
...@@ -371,7 +373,6 @@ int ...@@ -371,7 +373,6 @@ int
DeleteProperty(WindowPtr pWin, Atom propName) DeleteProperty(WindowPtr pWin, Atom propName)
{ {
PropertyPtr pProp, prevProp; PropertyPtr pProp, prevProp;
xEvent event;
if (!(pProp = wUserProps (pWin))) if (!(pProp = wUserProps (pWin)))
return(Success); return(Success);
...@@ -385,6 +386,7 @@ DeleteProperty(WindowPtr pWin, Atom propName) ...@@ -385,6 +386,7 @@ DeleteProperty(WindowPtr pWin, Atom propName)
} }
if (pProp) if (pProp)
{ {
xEvent event;
if (prevProp == (PropertyPtr)NULL) /* takes care of head */ if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{ {
if (!(pWin->optional->userProps = pProp->next)) if (!(pWin->optional->userProps = pProp->next))
...@@ -394,6 +396,7 @@ DeleteProperty(WindowPtr pWin, Atom propName) ...@@ -394,6 +396,7 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{ {
prevProp->next = pProp->next; prevProp->next = pProp->next;
} }
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete; event.u.property.state = PropertyDelete;
...@@ -412,6 +415,7 @@ DeleteAllWindowProperties(WindowPtr pWin) ...@@ -412,6 +415,7 @@ DeleteAllWindowProperties(WindowPtr pWin)
PropertyPtr pProp, pNextProp; PropertyPtr pProp, pNextProp;
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
pProp = wUserProps (pWin); pProp = wUserProps (pWin);
while (pProp) while (pProp)
{ {
...@@ -566,6 +570,7 @@ ProcGetProperty(ClientPtr client) ...@@ -566,6 +570,7 @@ ProcGetProperty(ClientPtr client)
{ /* send the event */ { /* send the event */
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete; event.u.property.state = PropertyDelete;
...@@ -628,6 +633,7 @@ ProcListProperties(ClientPtr client) ...@@ -628,6 +633,7 @@ ProcListProperties(ClientPtr client)
if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom)))) if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
return(BadAlloc); return(BadAlloc);
memset(&xlpr, 0, sizeof(xListPropertiesReply));
xlpr.type = X_Reply; xlpr.type = X_Reply;
xlpr.nProperties = numProps; xlpr.nProperties = numProps;
xlpr.length = (numProps * sizeof(Atom)) >> 2; xlpr.length = (numProps * sizeof(Atom)) >> 2;
......
...@@ -224,8 +224,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) ...@@ -224,8 +224,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
void nxagentClearSelection(XEvent *X) void nxagentClearSelection(XEvent *X)
{ {
xEvent x;
int i = 0; int i = 0;
#ifdef DEBUG #ifdef DEBUG
...@@ -252,6 +250,8 @@ void nxagentClearSelection(XEvent *X) ...@@ -252,6 +250,8 @@ void nxagentClearSelection(XEvent *X)
{ {
if (lastSelectionOwner[i].client != NULL) if (lastSelectionOwner[i].client != NULL)
{ {
xEvent x;
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionClear; x.u.u.type = SelectionClear;
x.u.selectionClear.time = GetTimeInMillis(); x.u.selectionClear.time = GetTimeInMillis();
x.u.selectionClear.window = lastSelectionOwner[i].window; x.u.selectionClear.window = lastSelectionOwner[i].window;
...@@ -315,6 +315,7 @@ FIXME: Do we need this? ...@@ -315,6 +315,7 @@ FIXME: Do we need this?
XFree(strTarget); XFree(strTarget);
} }
*/ */
memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.property = None; eventSelection.property = None;
if (X->xselectionrequest.target == serverTARGETS) if (X->xselectionrequest.target == serverTARGETS)
...@@ -423,6 +424,7 @@ FIXME: Do we need this? ...@@ -423,6 +424,7 @@ FIXME: Do we need this?
lastServerTime = X->xselectionrequest.time; lastServerTime = X->xselectionrequest.time;
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionRequest; x.u.u.type = SelectionRequest;
x.u.selectionRequest.time = GetTimeInMillis(); x.u.selectionRequest.time = GetTimeInMillis();
x.u.selectionRequest.owner = lastSelectionOwner[i].window; x.u.selectionRequest.owner = lastSelectionOwner[i].window;
...@@ -501,6 +503,7 @@ void nxagentSendSelectionNotify(Atom property) ...@@ -501,6 +503,7 @@ void nxagentSendSelectionNotify(Atom property)
lastClientClientPtr -> index); lastClientClientPtr -> index);
#endif #endif
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify; x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = lastClientTime; x.u.selectionNotify.time = lastClientTime;
...@@ -980,6 +983,7 @@ void nxagentNotifySelection(XEvent *X) ...@@ -980,6 +983,7 @@ void nxagentNotifySelection(XEvent *X)
} }
memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.type = SelectionNotify; eventSelection.type = SelectionNotify;
eventSelection.send_event = True; eventSelection.send_event = True;
eventSelection.display = nxagentDisplay; eventSelection.display = nxagentDisplay;
...@@ -1150,6 +1154,7 @@ FIXME: Why this pointer can be not a valid ...@@ -1150,6 +1154,7 @@ FIXME: Why this pointer can be not a valid
return; return;
} }
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify; x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time; x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor; x.u.selectionNotify.requestor = requestor;
...@@ -1255,6 +1260,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1255,6 +1260,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
4, 4,
&xa_STRING, 1); &xa_STRING, 1);
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify; x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time; x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor; x.u.selectionNotify.requestor = requestor;
...@@ -1287,6 +1293,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1287,6 +1293,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
(unsigned char *) &lastSelectionOwner[i].lastTimeChanged, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged,
1); 1);
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify; x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time; x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor; x.u.selectionNotify.requestor = requestor;
...@@ -1375,6 +1382,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1375,6 +1382,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
"to the requestor with property None.\n"); "to the requestor with property None.\n");
#endif #endif
memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify; x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time; x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor; x.u.selectionNotify.requestor = requestor;
...@@ -1407,6 +1415,7 @@ int nxagentSendNotify(xEvent *event) ...@@ -1407,6 +1415,7 @@ int nxagentSendNotify(xEvent *event)
* Setup selection notify event to real server. * Setup selection notify event to real server.
*/ */
memset(&x, 0, sizeof(XSelectionEvent));
x.type = SelectionNotify; x.type = SelectionNotify;
x.send_event = True; x.send_event = True;
x.display = nxagentDisplay; x.display = nxagentDisplay;
......
...@@ -1177,6 +1177,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1177,6 +1177,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentXkbNumTrap = 0; nxagentXkbNumTrap = 0;
} }
memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease; x.u.u.type = KeyRelease;
x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode); x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime + x.u.keyButtonPointer.time = nxagentLastKeyPressTime +
...@@ -1263,6 +1264,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1263,6 +1264,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
X.xbutton.window == nxagentFullscreenWindow && X.xbutton.window == nxagentFullscreenWindow &&
X.xbutton.subwindow == None)) X.xbutton.subwindow == None))
{ {
memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonPress; x.u.u.type = ButtonPress;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
...@@ -1336,6 +1338,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1336,6 +1338,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (minimize != True) if (minimize != True)
{ {
memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonRelease; x.u.u.type = ButtonRelease;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
...@@ -1402,6 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1402,6 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
} }
#endif #endif
memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify; x.u.u.type = MotionNotify;
if (nxagentOption(Rootless)) if (nxagentOption(Rootless))
...@@ -1583,6 +1587,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1583,6 +1587,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (!nxagentOption(Rootless) || if (!nxagentOption(Rootless) ||
inputInfo.keyboard->key->modifierMap[i * 8 + k]) inputInfo.keyboard->key->modifierMap[i * 8 + k])
{ {
memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease; x.u.u.type = KeyRelease;
x.u.u.detail = i * 8 + k; x.u.u.detail = i * 8 + k;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
...@@ -1706,6 +1711,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1706,6 +1711,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
{ {
NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y); NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify; x.u.u.type = MotionNotify;
if (nxagentOption(Rootless)) if (nxagentOption(Rootless))
...@@ -2337,6 +2343,7 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) ...@@ -2337,6 +2343,7 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis(); nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyPress; x.u.u.type = KeyPress;
x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode); x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime; x.u.keyButtonPointer.time = nxagentLastKeyPressTime;
...@@ -2641,7 +2648,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) ...@@ -2641,7 +2648,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{ {
WindowPtr pWin; WindowPtr pWin;
xEvent x;
*result = doNothing; *result = doNothing;
...@@ -2695,6 +2701,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) ...@@ -2695,6 +2701,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
char *message_data; char *message_data;
#endif #endif
xEvent x;
memset(&x, 0, sizeof(xEvent));
x.u.u.type = ClientMessage; x.u.u.type = ClientMessage;
x.u.u.detail = X -> xclient.format; x.u.u.detail = X -> xclient.format;
...@@ -3201,7 +3210,6 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3201,7 +3210,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
ClientPtr pClient; ClientPtr pClient;
WindowPtr pWinWindow; WindowPtr pWinWindow;
WindowPtr pWin; WindowPtr pWin;
xEvent x;
int sendEventAnyway = 0; int sendEventAnyway = 0;
pWinWindow = nxagentWindowPtr(X -> xconfigure.window); pWinWindow = nxagentWindowPtr(X -> xconfigure.window);
...@@ -3294,6 +3302,9 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3294,6 +3302,9 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (sendEventAnyway || X -> xconfigure.send_event) if (sendEventAnyway || X -> xconfigure.send_event)
{ {
xEvent x;
memset(&x, 0, sizeof(xEvent));
x.u.u.type = X -> xconfigure.type; x.u.u.type = X -> xconfigure.type;
x.u.u.type |= 0x80; x.u.u.type |= 0x80;
...@@ -3767,6 +3778,7 @@ void nxagentSendFakeKey(int key) ...@@ -3767,6 +3778,7 @@ void nxagentSendFakeKey(int key)
now = GetTimeInMillis(); now = GetTimeInMillis();
memset(&fake, 0, sizeof(xEvent));
fake.u.u.type = KeyPress; fake.u.u.type = KeyPress;
fake.u.u.detail = key; fake.u.u.detail = key;
fake.u.keyButtonPointer.time = now; fake.u.keyButtonPointer.time = now;
...@@ -3792,6 +3804,8 @@ int nxagentInitKeyboardState() ...@@ -3792,6 +3804,8 @@ int nxagentInitKeyboardState()
fprintf(stderr, "nxagentInitKeyboardState: Initializing XKB state.\n"); fprintf(stderr, "nxagentInitKeyboardState: Initializing XKB state.\n");
#endif #endif
memset(&X, 0, sizeof(XEvent));
XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers); XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers);
xkbev -> state.locked_mods = 0x0; xkbev -> state.locked_mods = 0x0;
......
...@@ -95,10 +95,9 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) ...@@ -95,10 +95,9 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats); nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats);
pFormats = (PictFormatPtr) malloc (nformats * sizeof (PictFormatRec)); pFormats = (PictFormatPtr) calloc (nformats, sizeof (PictFormatRec));
if (!pFormats) if (!pFormats)
return 0; return 0;
memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
for (f = 0; f < nformats; f++) for (f = 0; f < nformats; f++)
{ {
pFormats[f].id = FakeClientID (0); pFormats[f].id = FakeClientID (0);
...@@ -198,7 +197,7 @@ AllocatePicture (ScreenPtr pScreen) ...@@ -198,7 +197,7 @@ AllocatePicture (ScreenPtr pScreen)
unsigned int size; unsigned int size;
int i; int i;
pPicture = (PicturePtr) malloc (ps->totalPictureSize); pPicture = (PicturePtr) calloc(1, ps->totalPictureSize);
if (!pPicture) if (!pPicture)
return 0; return 0;
ppriv = (DevUnion *)(pPicture + 1); ppriv = (DevUnion *)(pPicture + 1);
...@@ -289,7 +288,7 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error) ...@@ -289,7 +288,7 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
} }
pPicture->id = pid; pPicture->id = pid;
pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); pPicture->pSourcePict = (SourcePictPtr) calloc(1, sizeof(PictSolidFill));
if (!pPicture->pSourcePict) { if (!pPicture->pSourcePict) {
*error = BadAlloc; *error = BadAlloc;
free(pPicture); free(pPicture);
...@@ -326,7 +325,7 @@ static PicturePtr createSourcePicture(void) ...@@ -326,7 +325,7 @@ static PicturePtr createSourcePicture(void)
picturePrivateCount * sizeof(DevUnion) + picturePrivateCount * sizeof(DevUnion) +
sizeof(nxagentPrivPictureRec); sizeof(nxagentPrivPictureRec);
pPicture = (PicturePtr) malloc(totalPictureSize); pPicture = (PicturePtr) calloc(1, totalPictureSize);
if (pPicture != NULL) if (pPicture != NULL)
{ {
......
...@@ -205,6 +205,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, ...@@ -205,6 +205,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
void * data; void * data;
int copySize; int copySize;
memset(&event, 0, sizeof(xEvent));
sizeInBytes = format>>3; sizeInBytes = format>>3;
totalSize = len * sizeInBytes; totalSize = len * sizeInBytes;
...@@ -332,11 +334,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, ...@@ -332,11 +334,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int int
ProcGetProperty(ClientPtr client) ProcGetProperty(ClientPtr client)
{ {
#ifdef NXAGENT_SERVER
nxagentWMStateRec wmState;
nxagentWMStateRec *wmsP = &wmState;
#endif
PropertyPtr pProp, prevProp; PropertyPtr pProp, prevProp;
unsigned long n, len, ind; unsigned long n, len, ind;
WindowPtr pWin; WindowPtr pWin;
...@@ -395,6 +392,10 @@ ProcGetProperty(ClientPtr client) ...@@ -395,6 +392,10 @@ ProcGetProperty(ClientPtr client)
(!pProp) && (!pProp) &&
strcmp(NameForAtom(stuff->property), "WM_STATE") == 0) strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
{ {
nxagentWMStateRec wmState;
nxagentWMStateRec *wmsP = &wmState;
memset(&wmState, 0, sizeof(nxagentWMStateRec));
wmState.state = 1; wmState.state = 1;
wmState.icon = None; wmState.icon = None;
...@@ -498,6 +499,7 @@ ProcGetProperty(ClientPtr client) ...@@ -498,6 +499,7 @@ ProcGetProperty(ClientPtr client)
{ /* send the event */ { /* send the event */
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete; event.u.property.state = PropertyDelete;
...@@ -620,6 +622,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, ...@@ -620,6 +622,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
{ /* send the event */ { /* send the event */
xEvent event; xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify; event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id; event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete; event.u.property.state = PropertyDelete;
......
...@@ -229,10 +229,9 @@ ProcRenderQueryPictFormats (ClientPtr client) ...@@ -229,10 +229,9 @@ ProcRenderQueryPictFormats (ClientPtr client)
ndepth * sizeof (xPictDepth) + ndepth * sizeof (xPictDepth) +
nvisual * sizeof (xPictVisual) + nvisual * sizeof (xPictVisual) +
numSubpixel * sizeof (CARD32)); numSubpixel * sizeof (CARD32));
reply = (xRenderQueryPictFormatsReply *) malloc (rlength); reply = (xRenderQueryPictFormatsReply *) calloc (1, rlength);
if (!reply) if (!reply)
return BadAlloc; return BadAlloc;
memset(reply, 0, rlength);
reply->type = X_Reply; reply->type = X_Reply;
reply->sequenceNumber = client->sequence; reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->length = (rlength - sizeof(xGenericReply)) >> 2;
......
...@@ -240,7 +240,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) ...@@ -240,7 +240,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
length = nxagentImageLength(sw, sh, format, 0, depth); length = nxagentImageLength(sw, sh, format, 0, depth);
if ((newdata = malloc(length)) != NULL) if ((newdata = calloc(1, length)) != NULL)
{ {
fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata); fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata);
(*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata); (*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
...@@ -360,6 +360,7 @@ ProcShmPutImage(client) ...@@ -360,6 +360,7 @@ ProcShmPutImage(client)
{ {
xShmCompletionEvent ev; xShmCompletionEvent ev;
memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode; ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable; ev.drawable = stuff->drawable;
ev.sequenceNumber = client->sequence; ev.sequenceNumber = client->sequence;
......
...@@ -1018,6 +1018,7 @@ ProcRRGetCrtcInfo(ClientPtr client) ...@@ -1018,6 +1018,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
mode = crtc->mode; mode = crtc->mode;
memset(&rep, 0, sizeof(xRRGetCrtcInfoReply));
rep = (xRRGetCrtcInfoReply) { rep = (xRRGetCrtcInfoReply) {
.type = X_Reply, .type = X_Reply,
.status = RRSetConfigSuccess, .status = RRSetConfigSuccess,
...@@ -1055,7 +1056,7 @@ ProcRRGetCrtcInfo(ClientPtr client) ...@@ -1055,7 +1056,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
extraLen = rep.length << 2; extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = calloc(1, extraLen);
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
...@@ -1313,6 +1314,7 @@ ProcRRSetCrtcConfig(ClientPtr client) ...@@ -1313,6 +1314,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
sendReply: sendReply:
free(outputs); free(outputs);
memset(&rep, 0, sizeof(xRRSetCrtcConfigReply));
rep = (xRRSetCrtcConfigReply) { rep = (xRRSetCrtcConfigReply) {
.type = X_Reply, .type = X_Reply,
.status = status, .status = status,
...@@ -1354,6 +1356,7 @@ ProcRRGetPanning(ClientPtr client) ...@@ -1354,6 +1356,7 @@ ProcRRGetPanning(ClientPtr client)
if (!pScrPriv) if (!pScrPriv)
return RRErrorBase + BadRRCrtc; return RRErrorBase + BadRRCrtc;
memset(&rep, 0, sizeof(xRRGetPanningReply));
rep = (xRRGetPanningReply) { rep = (xRRGetPanningReply) {
.type = X_Reply, .type = X_Reply,
.status = RRSetConfigSuccess, .status = RRSetConfigSuccess,
...@@ -1453,6 +1456,7 @@ ProcRRSetPanning(ClientPtr client) ...@@ -1453,6 +1456,7 @@ ProcRRSetPanning(ClientPtr client)
status = RRSetConfigSuccess; status = RRSetConfigSuccess;
sendReply: sendReply:
memset(&rep, 0, sizeof(xRRSetPanningReply));
rep = (xRRSetPanningReply) { rep = (xRRSetPanningReply) {
.type = X_Reply, .type = X_Reply,
.status = status, .status = status,
...@@ -1517,7 +1521,7 @@ ProcRRGetCrtcGamma(ClientPtr client) ...@@ -1517,7 +1521,7 @@ ProcRRGetCrtcGamma(ClientPtr client)
len = crtc->gammaSize * 3 * 2; len = crtc->gammaSize * 3 * 2;
if (crtc->gammaSize) { if (crtc->gammaSize) {
extra = malloc(len); extra = calloc(1, len);
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
......
...@@ -494,7 +494,7 @@ ProcRRGetOutputInfo(ClientPtr client) ...@@ -494,7 +494,7 @@ ProcRRGetOutputInfo(ClientPtr client)
if (extraLen) { if (extraLen) {
rep.length += bytes_to_int32(extraLen); rep.length += bytes_to_int32(extraLen);
extra = malloc(extraLen); extra = calloc(1, extraLen);
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
......
...@@ -120,7 +120,7 @@ ProcRRGetProviders(ClientPtr client) ...@@ -120,7 +120,7 @@ ProcRRGetProviders(ClientPtr client)
}; };
extraLen = rep.length << 2; extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = calloc(1, extraLen);
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} else } else
...@@ -215,7 +215,7 @@ ProcRRGetProviderInfo(ClientPtr client) ...@@ -215,7 +215,7 @@ ProcRRGetProviderInfo(ClientPtr client)
extraLen = rep.length << 2; extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = calloc(1, extraLen);
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
......
...@@ -457,7 +457,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) ...@@ -457,7 +457,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
extraLen = rep.length << 2; extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = calloc(1,extraLen);
if (!extra) { if (!extra) {
return BadAlloc; return BadAlloc;
} }
...@@ -595,7 +595,7 @@ rrGetScreenResources(ClientPtr client, Bool query) ...@@ -595,7 +595,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
extraLen = rep.length << 2; extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = calloc(1, extraLen);
if (!extra) { if (!extra) {
free(modes); free(modes);
return BadAlloc; return BadAlloc;
...@@ -873,7 +873,7 @@ ProcRRGetScreenInfo(ClientPtr client) ...@@ -873,7 +873,7 @@ ProcRRGetScreenInfo(ClientPtr client)
extraLen += rep.nrateEnts * sizeof(CARD16); extraLen += rep.nrateEnts * sizeof(CARD16);
if (extraLen) { if (extraLen) {
extra = (CARD8 *) malloc(extraLen); extra = (CARD8 *) calloc(1, extraLen);
if (!extra) { if (!extra) {
free(pData); free(pData);
return BadAlloc; return BadAlloc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment