aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/dix
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-03 11:04:10 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-03 11:04:10 +0100
commit20029dbc8f7d03211ceaf00001418fb75b9df644 (patch)
treee8950e052bb5ee4328a052a9cf04efc847c47eff /nx-X11/programs/Xserver/dix
parent9d41e84ea9baf215c6de11224dc2597cd37359dc (diff)
parent3e315cd17a519dbcafff18d4294a6f7bb8070767 (diff)
downloadnx-libs-20029dbc8f7d03211ceaf00001418fb75b9df644.tar.gz
nx-libs-20029dbc8f7d03211ceaf00001418fb75b9df644.tar.bz2
nx-libs-20029dbc8f7d03211ceaf00001418fb75b9df644.zip
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
Diffstat (limited to 'nx-X11/programs/Xserver/dix')
-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
4 files changed, 29 insertions, 20 deletions
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;