aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-02-25 02:17:18 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-03-02 12:22:40 +0100
commit3e315cd17a519dbcafff18d4294a6f7bb8070767 (patch)
treee8950e052bb5ee4328a052a9cf04efc847c47eff /nx-X11/programs/Xserver
parent9d41e84ea9baf215c6de11224dc2597cd37359dc (diff)
downloadnx-libs-3e315cd17a519dbcafff18d4294a6f7bb8070767.tar.gz
nx-libs-3e315cd17a519dbcafff18d4294a6f7bb8070767.tar.bz2
nx-libs-3e315cd17a519dbcafff18d4294a6f7bb8070767.zip
Fix "uninitialised byte(s)" complaints from valgrind
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/Xext/shm.c5
-rw-r--r--nx-X11/programs/Xserver/Xext/xf86bigfont.c5
-rw-r--r--nx-X11/programs/Xserver/damageext/damageext.c2
-rw-r--r--nx-X11/programs/Xserver/dix/devices.c29
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c2
-rw-r--r--nx-X11/programs/Xserver/dix/events.c6
-rw-r--r--nx-X11/programs/Xserver/dix/property.c12
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c13
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c18
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXpicture.c9
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXproperty.c13
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXrender.c3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXshm.c3
-rw-r--r--nx-X11/programs/Xserver/randr/rrcrtc.c8
-rw-r--r--nx-X11/programs/Xserver/randr/rroutput.c2
-rw-r--r--nx-X11/programs/Xserver/randr/rrprovider.c4
-rw-r--r--nx-X11/programs/Xserver/randr/rrscreen.c6
17 files changed, 93 insertions, 47 deletions
diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c
index e3fa3a24e..263adc3df 100644
--- a/nx-X11/programs/Xserver/Xext/shm.c
+++ b/nx-X11/programs/Xserver/Xext/shm.c
@@ -660,6 +660,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
for(i = 1; i < PanoramiXNumScreens; i++)
VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+ memset(&xgi, 0, sizeof(xShmGetImageReply));
xgi.visual = wVisual(((WindowPtr)pDraw));
xgi.type = X_Reply;
xgi.length = 0;
@@ -913,6 +914,7 @@ ProcShmPutImage(client)
{
xShmCompletionEvent ev;
+ memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
ev.minorEvent = X_ShmPutImage;
@@ -947,6 +949,9 @@ ProcShmGetImage(client)
}
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+
+ memset(&xgi, 0, sizeof(xShmGetImageReply));
+
if (pDraw->type == DRAWABLE_WINDOW)
{
if( /* check for being viewable */
diff --git a/nx-X11/programs/Xserver/Xext/xf86bigfont.c b/nx-X11/programs/Xserver/Xext/xf86bigfont.c
index 6ec47c4f4..9530a9d7f 100644
--- a/nx-X11/programs/Xserver/Xext/xf86bigfont.c
+++ b/nx-X11/programs/Xserver/Xext/xf86bigfont.c
@@ -354,6 +354,7 @@ ProcXF86BigfontQueryVersion(
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
+ memset(&reply, 0, sizeof(xXF86BigfontQueryVersionReply));
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
@@ -638,7 +639,7 @@ ProcXF86BigfontQueryFont(
+ (nCharInfos+1)/2 * 2 * sizeof(CARD16)
: 0);
xXF86BigfontQueryFontReply* reply =
- (xXF86BigfontQueryFontReply *) ALLOCATE_LOCAL(rlength);
+ (xXF86BigfontQueryFontReply *) calloc(1, rlength);
char* p;
if (!reply) {
if (nCharInfos > 0) {
@@ -718,7 +719,7 @@ ProcXF86BigfontQueryFont(
}
}
WriteToClient(client, rlength, reply);
- DEALLOCATE_LOCAL(reply);
+ free(reply);
if (nCharInfos > 0) {
if (shmid == -1) DEALLOCATE_LOCAL(pIndex2UniqIndex);
if (!pDesc) DEALLOCATE_LOCAL(pCI);
diff --git a/nx-X11/programs/Xserver/damageext/damageext.c b/nx-X11/programs/Xserver/damageext/damageext.c
index 6ade82f84..b5e5d0b00 100644
--- a/nx-X11/programs/Xserver/damageext/damageext.c
+++ b/nx-X11/programs/Xserver/damageext/damageext.c
@@ -136,6 +136,8 @@ ProcDamageQueryVersion(ClientPtr client)
REQUEST(xDamageQueryVersionReq);
REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
+
+ memset(&rep, 0, sizeof(xDamageQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index ad1788277..1d09cde8c 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -80,7 +80,7 @@ _AddInputDevice(DeviceProc deviceProc, Bool autoStart)
if (inputInfo.numDevices >= MAX_DEVICES)
return (DeviceIntPtr)NULL;
- dev = (DeviceIntPtr) malloc(sizeof(DeviceIntRec));
+ dev = (DeviceIntPtr) calloc(1, sizeof(DeviceIntRec));
if (!dev)
return (DeviceIntPtr)NULL;
dev->name = (char *)NULL;
@@ -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)
return (FALSE);
- bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
for (i = 0; i < 8; i++)
keysPerModifier[i] = 0;
for (i = 8; i < MAP_LENGTH; i++)
@@ -525,7 +524,7 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
int i;
register KeyClassPtr keyc;
- keyc = (KeyClassPtr)malloc(sizeof(KeyClassRec));
+ keyc = (KeyClassPtr)calloc(1, sizeof(KeyClassRec));
if (!keyc)
return FALSE;
keyc->curKeySyms.map = (KeySym *)NULL;
@@ -564,7 +563,7 @@ InitButtonClassDeviceStruct(register DeviceIntPtr dev, int numButtons,
register ButtonClassPtr butc;
int i;
- butc = (ButtonClassPtr)malloc(sizeof(ButtonClassRec));
+ butc = (ButtonClassPtr)calloc(1, sizeof(ButtonClassRec));
if (!butc)
return FALSE;
butc->numButtons = numButtons;
@@ -589,7 +588,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
int i;
register ValuatorClassPtr valc;
- valc = (ValuatorClassPtr)malloc(sizeof(ValuatorClassRec) +
+ valc = (ValuatorClassPtr)calloc(1, sizeof(ValuatorClassRec) +
numAxes * sizeof(AxisInfo) +
numAxes * sizeof(unsigned int));
if (!valc)
@@ -612,7 +611,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
{
register FocusClassPtr focc;
- focc = (FocusClassPtr)malloc(sizeof(FocusClassRec));
+ focc = (FocusClassPtr)calloc(1, sizeof(FocusClassRec));
if (!focc)
return FALSE;
focc->win = PointerRootWin;
@@ -631,7 +630,7 @@ InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
{
register KbdFeedbackPtr feedc;
- feedc = (KbdFeedbackPtr)malloc(sizeof(KbdFeedbackClassRec));
+ feedc = (KbdFeedbackPtr)calloc(1, sizeof(KbdFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->BellProc = bellProc;
@@ -658,7 +657,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
{
register PtrFeedbackPtr feedc;
- feedc = (PtrFeedbackPtr)malloc(sizeof(PtrFeedbackClassRec));
+ feedc = (PtrFeedbackPtr)calloc(1, sizeof(PtrFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->CtrlProc = controlProc;
@@ -696,7 +695,7 @@ InitStringFeedbackClassDeviceStruct (
int i;
register StringFeedbackPtr feedc;
- feedc = (StringFeedbackPtr)malloc(sizeof(StringFeedbackClassRec));
+ feedc = (StringFeedbackPtr)calloc(1, sizeof(StringFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->CtrlProc = controlProc;
@@ -704,9 +703,9 @@ InitStringFeedbackClassDeviceStruct (
feedc->ctrl.num_symbols_displayed = 0;
feedc->ctrl.max_symbols = max_symbols;
feedc->ctrl.symbols_supported = (KeySym *)
- malloc (sizeof (KeySym) * num_symbols_supported);
+ calloc (num_symbols_supported, sizeof (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)
@@ -734,7 +733,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
{
register BellFeedbackPtr feedc;
- feedc = (BellFeedbackPtr)malloc(sizeof(BellFeedbackClassRec));
+ feedc = (BellFeedbackPtr)calloc(1, sizeof(BellFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->CtrlProc = controlProc;
@@ -753,7 +752,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
{
register LedFeedbackPtr feedc;
- feedc = (LedFeedbackPtr)malloc(sizeof(LedFeedbackClassRec));
+ feedc = (LedFeedbackPtr)calloc(1, sizeof(LedFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->CtrlProc = controlProc;
@@ -774,7 +773,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
{
register IntegerFeedbackPtr feedc;
- feedc = (IntegerFeedbackPtr)malloc(sizeof(IntegerFeedbackClassRec));
+ feedc = (IntegerFeedbackPtr)calloc(1, sizeof(IntegerFeedbackClassRec));
if (!feedc)
return FALSE;
feedc->CtrlProc = controlProc;
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index 8313d5bff..c8971b86c 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -2584,6 +2584,7 @@ ProcAllocColor (register ClientPtr client)
RT_COLORMAP, DixWriteAccess);
if (pmap)
{
+ memset(&acr, 0, sizeof(xAllocColorReply));
acr.type = X_Reply;
acr.length = 0;
acr.sequenceNumber = client->sequence;
@@ -3766,6 +3767,7 @@ SendConnSetup(register ClientPtr client, char *reason)
{
xConnSetupPrefix csp;
+ memset(&csp, 0, sizeof(xConnSetupPrefix));
csp.success = xFalse;
csp.lengthReason = strlen(reason);
csp.length = (csp.lengthReason + (unsigned)3) >> 2;
diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c
index fde3e91dd..73187f712 100644
--- a/nx-X11/programs/Xserver/dix/events.c
+++ b/nx-X11/programs/Xserver/dix/events.c
@@ -652,6 +652,7 @@ SyntheticMotion(int x, int y)
y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
}
#endif
+ memset(&xE, 0, sizeof(xEvent));
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents)
@@ -1022,7 +1023,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
return;
}
}
- qe = (QdEventPtr)malloc(sizeof(QdEventRec) + (count * sizeof(xEvent)));
+ qe = (QdEventPtr)calloc(1, sizeof(QdEventRec) + (count * sizeof(xEvent)));
if (!qe)
return;
qe->next = (QdEventPtr)NULL;
@@ -3100,7 +3101,6 @@ EnterLeaveEvent(
register WindowPtr pWin,
Window child)
{
- xEvent event;
register DeviceIntPtr keybd = inputInfo.keyboard;
WindowPtr focus;
register DeviceIntPtr mouse = inputInfo.pointer;
@@ -3122,6 +3122,7 @@ EnterLeaveEvent(
}
if (mask & filters[type])
{
+ xEvent event;
memset(&event, 0, sizeof(xEvent));
event.u.u.type = type;
event.u.u.detail = detail;
@@ -3244,6 +3245,7 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr
return;
}
#endif
+ memset(&event, 0, sizeof(xEvent));
event.u.focus.mode = mode;
event.u.u.type = type;
event.u.u.detail = detail;
diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c
index f5713cf5e..211c4cce2 100644
--- a/nx-X11/programs/Xserver/dix/property.c
+++ b/nx-X11/programs/Xserver/dix/property.c
@@ -101,7 +101,6 @@ ProcRotateProperties(ClientPtr client)
register Atom * atoms;
PropertyPtr * props; /* array of pointer */
PropertyPtr pProp;
- xEvent event;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime();
@@ -169,7 +168,9 @@ found:
{
/* Generate a PropertyNotify event for each property whose value
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.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue;
@@ -259,7 +260,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
Bool sendevent)
{
PropertyPtr pProp;
- xEvent event;
int sizeInBytes;
int totalSize;
void * data;
@@ -356,6 +356,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
if (sendevent)
{
+ xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue;
@@ -371,7 +373,6 @@ int
DeleteProperty(WindowPtr pWin, Atom propName)
{
PropertyPtr pProp, prevProp;
- xEvent event;
if (!(pProp = wUserProps (pWin)))
return(Success);
@@ -385,6 +386,7 @@ DeleteProperty(WindowPtr pWin, Atom propName)
}
if (pProp)
{
+ xEvent event;
if (prevProp == (PropertyPtr)NULL) /* takes care of head */
{
if (!(pWin->optional->userProps = pProp->next))
@@ -394,6 +396,7 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{
prevProp->next = pProp->next;
}
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -412,6 +415,7 @@ DeleteAllWindowProperties(WindowPtr pWin)
PropertyPtr pProp, pNextProp;
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
pProp = wUserProps (pWin);
while (pProp)
{
@@ -566,6 +570,7 @@ ProcGetProperty(ClientPtr client)
{ /* send the event */
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -628,6 +633,7 @@ ProcListProperties(ClientPtr client)
if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom))))
return(BadAlloc);
+ memset(&xlpr, 0, sizeof(xListPropertiesReply));
xlpr.type = X_Reply;
xlpr.nProperties = numProps;
xlpr.length = (numProps * sizeof(Atom)) >> 2;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 2e6f38efd..d26d3524a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -224,8 +224,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
void nxagentClearSelection(XEvent *X)
{
- xEvent x;
-
int i = 0;
#ifdef DEBUG
@@ -252,6 +250,8 @@ void nxagentClearSelection(XEvent *X)
{
if (lastSelectionOwner[i].client != NULL)
{
+ xEvent x;
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionClear;
x.u.selectionClear.time = GetTimeInMillis();
x.u.selectionClear.window = lastSelectionOwner[i].window;
@@ -315,6 +315,7 @@ FIXME: Do we need this?
XFree(strTarget);
}
*/
+ memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.property = None;
if (X->xselectionrequest.target == serverTARGETS)
@@ -423,6 +424,7 @@ FIXME: Do we need this?
lastServerTime = X->xselectionrequest.time;
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionRequest;
x.u.selectionRequest.time = GetTimeInMillis();
x.u.selectionRequest.owner = lastSelectionOwner[i].window;
@@ -501,6 +503,7 @@ void nxagentSendSelectionNotify(Atom property)
lastClientClientPtr -> index);
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = lastClientTime;
@@ -980,6 +983,7 @@ void nxagentNotifySelection(XEvent *X)
}
+ memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.type = SelectionNotify;
eventSelection.send_event = True;
eventSelection.display = nxagentDisplay;
@@ -1150,6 +1154,7 @@ FIXME: Why this pointer can be not a valid
return;
}
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1255,6 +1260,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
4,
&xa_STRING, 1);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1287,6 +1293,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
(unsigned char *) &lastSelectionOwner[i].lastTimeChanged,
1);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1375,6 +1382,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
"to the requestor with property None.\n");
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1407,6 +1415,7 @@ int nxagentSendNotify(xEvent *event)
* Setup selection notify event to real server.
*/
+ memset(&x, 0, sizeof(XSelectionEvent));
x.type = SelectionNotify;
x.send_event = True;
x.display = nxagentDisplay;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index efe745718..d8512b548 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1177,6 +1177,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentXkbNumTrap = 0;
}
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease;
x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime +
@@ -1263,6 +1264,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
X.xbutton.window == nxagentFullscreenWindow &&
X.xbutton.subwindow == None))
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonPress;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1336,6 +1338,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (minimize != True)
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonRelease;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1402,6 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify;
if (nxagentOption(Rootless))
@@ -1583,6 +1587,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (!nxagentOption(Rootless) ||
inputInfo.keyboard->key->modifierMap[i * 8 + k])
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease;
x.u.u.detail = i * 8 + k;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1706,6 +1711,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
{
NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify;
if (nxagentOption(Rootless))
@@ -2337,6 +2343,7 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyPress;
x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime;
@@ -2641,7 +2648,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{
WindowPtr pWin;
- xEvent x;
*result = doNothing;
@@ -2695,6 +2701,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
char *message_data;
#endif
+ xEvent x;
+
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ClientMessage;
x.u.u.detail = X -> xclient.format;
@@ -3201,7 +3210,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
ClientPtr pClient;
WindowPtr pWinWindow;
WindowPtr pWin;
- xEvent x;
int sendEventAnyway = 0;
pWinWindow = nxagentWindowPtr(X -> xconfigure.window);
@@ -3294,6 +3302,9 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (sendEventAnyway || X -> xconfigure.send_event)
{
+ xEvent x;
+
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = X -> xconfigure.type;
x.u.u.type |= 0x80;
@@ -3767,6 +3778,7 @@ void nxagentSendFakeKey(int key)
now = GetTimeInMillis();
+ memset(&fake, 0, sizeof(xEvent));
fake.u.u.type = KeyPress;
fake.u.u.detail = key;
fake.u.keyButtonPointer.time = now;
@@ -3792,6 +3804,8 @@ int nxagentInitKeyboardState()
fprintf(stderr, "nxagentInitKeyboardState: Initializing XKB state.\n");
#endif
+ memset(&X, 0, sizeof(XEvent));
+
XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers);
xkbev -> state.locked_mods = 0x0;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
index 1188d06bf..53a4633e5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
@@ -95,10 +95,9 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats);
- pFormats = (PictFormatPtr) malloc (nformats * sizeof (PictFormatRec));
+ pFormats = (PictFormatPtr) calloc (nformats, sizeof (PictFormatRec));
if (!pFormats)
return 0;
- memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
for (f = 0; f < nformats; f++)
{
pFormats[f].id = FakeClientID (0);
@@ -198,7 +197,7 @@ AllocatePicture (ScreenPtr pScreen)
unsigned int size;
int i;
- pPicture = (PicturePtr) malloc (ps->totalPictureSize);
+ pPicture = (PicturePtr) calloc(1, ps->totalPictureSize);
if (!pPicture)
return 0;
ppriv = (DevUnion *)(pPicture + 1);
@@ -289,7 +288,7 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
}
pPicture->id = pid;
- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
+ pPicture->pSourcePict = (SourcePictPtr) calloc(1, sizeof(PictSolidFill));
if (!pPicture->pSourcePict) {
*error = BadAlloc;
free(pPicture);
@@ -326,7 +325,7 @@ static PicturePtr createSourcePicture(void)
picturePrivateCount * sizeof(DevUnion) +
sizeof(nxagentPrivPictureRec);
- pPicture = (PicturePtr) malloc(totalPictureSize);
+ pPicture = (PicturePtr) calloc(1, totalPictureSize);
if (pPicture != NULL)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
index 28fdd19f5..ee77eb64e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
@@ -205,6 +205,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
void * data;
int copySize;
+ memset(&event, 0, sizeof(xEvent));
+
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
@@ -332,11 +334,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int
ProcGetProperty(ClientPtr client)
{
- #ifdef NXAGENT_SERVER
- nxagentWMStateRec wmState;
- nxagentWMStateRec *wmsP = &wmState;
- #endif
-
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
@@ -395,6 +392,10 @@ ProcGetProperty(ClientPtr client)
(!pProp) &&
strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
{
+ nxagentWMStateRec wmState;
+ nxagentWMStateRec *wmsP = &wmState;
+
+ memset(&wmState, 0, sizeof(nxagentWMStateRec));
wmState.state = 1;
wmState.icon = None;
@@ -498,6 +499,7 @@ ProcGetProperty(ClientPtr client)
{ /* send the event */
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -620,6 +622,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
{ /* send the event */
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
index 8d55516fb..36aa3323e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
@@ -229,10 +229,9 @@ ProcRenderQueryPictFormats (ClientPtr client)
ndepth * sizeof (xPictDepth) +
nvisual * sizeof (xPictVisual) +
numSubpixel * sizeof (CARD32));
- reply = (xRenderQueryPictFormatsReply *) malloc (rlength);
+ reply = (xRenderQueryPictFormatsReply *) calloc (1, rlength);
if (!reply)
return BadAlloc;
- memset(reply, 0, rlength);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
index fa60917e3..f251f3b9f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
@@ -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);
- if ((newdata = malloc(length)) != NULL)
+ if ((newdata = calloc(1, length)) != NULL)
{
fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata);
(*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
@@ -360,6 +360,7 @@ ProcShmPutImage(client)
{
xShmCompletionEvent ev;
+ memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
ev.sequenceNumber = client->sequence;
diff --git a/nx-X11/programs/Xserver/randr/rrcrtc.c b/nx-X11/programs/Xserver/randr/rrcrtc.c
index 59a3f446a..1034eac5d 100644
--- a/nx-X11/programs/Xserver/randr/rrcrtc.c
+++ b/nx-X11/programs/Xserver/randr/rrcrtc.c
@@ -1018,6 +1018,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
mode = crtc->mode;
+ memset(&rep, 0, sizeof(xRRGetCrtcInfoReply));
rep = (xRRGetCrtcInfoReply) {
.type = X_Reply,
.status = RRSetConfigSuccess,
@@ -1055,7 +1056,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
extraLen = rep.length << 2;
if (extraLen) {
- extra = malloc(extraLen);
+ extra = calloc(1, extraLen);
if (!extra)
return BadAlloc;
}
@@ -1313,6 +1314,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
sendReply:
free(outputs);
+ memset(&rep, 0, sizeof(xRRSetCrtcConfigReply));
rep = (xRRSetCrtcConfigReply) {
.type = X_Reply,
.status = status,
@@ -1354,6 +1356,7 @@ ProcRRGetPanning(ClientPtr client)
if (!pScrPriv)
return RRErrorBase + BadRRCrtc;
+ memset(&rep, 0, sizeof(xRRGetPanningReply));
rep = (xRRGetPanningReply) {
.type = X_Reply,
.status = RRSetConfigSuccess,
@@ -1453,6 +1456,7 @@ ProcRRSetPanning(ClientPtr client)
status = RRSetConfigSuccess;
sendReply:
+ memset(&rep, 0, sizeof(xRRSetPanningReply));
rep = (xRRSetPanningReply) {
.type = X_Reply,
.status = status,
@@ -1517,7 +1521,7 @@ ProcRRGetCrtcGamma(ClientPtr client)
len = crtc->gammaSize * 3 * 2;
if (crtc->gammaSize) {
- extra = malloc(len);
+ extra = calloc(1, len);
if (!extra)
return BadAlloc;
}
diff --git a/nx-X11/programs/Xserver/randr/rroutput.c b/nx-X11/programs/Xserver/randr/rroutput.c
index c4da7d534..5235f39d7 100644
--- a/nx-X11/programs/Xserver/randr/rroutput.c
+++ b/nx-X11/programs/Xserver/randr/rroutput.c
@@ -494,7 +494,7 @@ ProcRRGetOutputInfo(ClientPtr client)
if (extraLen) {
rep.length += bytes_to_int32(extraLen);
- extra = malloc(extraLen);
+ extra = calloc(1, extraLen);
if (!extra)
return BadAlloc;
}
diff --git a/nx-X11/programs/Xserver/randr/rrprovider.c b/nx-X11/programs/Xserver/randr/rrprovider.c
index 0ac9474c6..1f884a7b2 100644
--- a/nx-X11/programs/Xserver/randr/rrprovider.c
+++ b/nx-X11/programs/Xserver/randr/rrprovider.c
@@ -120,7 +120,7 @@ ProcRRGetProviders(ClientPtr client)
};
extraLen = rep.length << 2;
if (extraLen) {
- extra = malloc(extraLen);
+ extra = calloc(1, extraLen);
if (!extra)
return BadAlloc;
} else
@@ -215,7 +215,7 @@ ProcRRGetProviderInfo(ClientPtr client)
extraLen = rep.length << 2;
if (extraLen) {
- extra = malloc(extraLen);
+ extra = calloc(1, extraLen);
if (!extra)
return BadAlloc;
}
diff --git a/nx-X11/programs/Xserver/randr/rrscreen.c b/nx-X11/programs/Xserver/randr/rrscreen.c
index 1a30b29d4..4f59e9aea 100644
--- a/nx-X11/programs/Xserver/randr/rrscreen.c
+++ b/nx-X11/programs/Xserver/randr/rrscreen.c
@@ -457,7 +457,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
extraLen = rep.length << 2;
if (extraLen) {
- extra = malloc(extraLen);
+ extra = calloc(1,extraLen);
if (!extra) {
return BadAlloc;
}
@@ -595,7 +595,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
extraLen = rep.length << 2;
if (extraLen) {
- extra = malloc(extraLen);
+ extra = calloc(1, extraLen);
if (!extra) {
free(modes);
return BadAlloc;
@@ -873,7 +873,7 @@ ProcRRGetScreenInfo(ClientPtr client)
extraLen += rep.nrateEnts * sizeof(CARD16);
if (extraLen) {
- extra = (CARD8 *) malloc(extraLen);
+ extra = (CARD8 *) calloc(1, extraLen);
if (!extra) {
free(pData);
return BadAlloc;