[X2Go-Commits] [nx-libs] 06/30: Fix some valgrind findings
git-admin at x2go.org
git-admin at x2go.org
Tue Jul 3 22:23:57 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x
in repository nx-libs.
commit 1e3db85a026338e5a56de9f75bddeff283ba24fb
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Thu Jun 21 21:46:52 2018 +0200
Fix some valgrind findings
Some of them have not been seen in the wild yet.
Partly fixes ArcticaProject/nx-libs#711
---
nx-X11/programs/Xserver/dix/devices.c | 18 ++++++++----------
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 8 +++-----
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index 1c7572d..d31ff82 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -908,7 +908,7 @@ AllModifierKeysAreUp(dev, map1, per1, map2, per2)
int
ProcSetModifierMapping(ClientPtr client)
{
- xSetModifierMappingReply rep;
+ xSetModifierMappingReply rep = {0};
REQUEST(xSetModifierMappingReq);
KeyCode *inputMap;
int inputMapLen;
@@ -1016,11 +1016,10 @@ ProcSetModifierMapping(ClientPtr client)
int
ProcGetModifierMapping(ClientPtr client)
{
- xGetModifierMappingReply rep;
+ xGetModifierMappingReply rep = {0};
register KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq);
- memset(&rep, 0, sizeof(xGetModifierMappingReply));
rep.type = X_Reply;
rep.numKeyPerModifier = keyc->maxKeysPerModifier;
rep.sequenceNumber = client->sequence;
@@ -1082,7 +1081,7 @@ ProcSetPointerMapping(ClientPtr client)
{
REQUEST(xSetPointerMappingReq);
BYTE *map;
- xSetPointerMappingReply rep;
+ xSetPointerMappingReply rep = {0};
register unsigned int i;
DeviceIntPtr mouse = inputInfo.pointer;
@@ -1119,7 +1118,7 @@ ProcSetPointerMapping(ClientPtr client)
int
ProcGetKeyboardMapping(ClientPtr client)
{
- xGetKeyboardMappingReply rep;
+ xGetKeyboardMappingReply rep = {0};
REQUEST(xGetKeyboardMappingReq);
KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
@@ -1138,7 +1137,6 @@ ProcGetKeyboardMapping(ClientPtr client)
return BadValue;
}
- memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = curKeySyms->mapWidth;
@@ -1387,7 +1385,7 @@ ProcGetKeyboardControl (ClientPtr client)
{
int i;
register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
- xGetKeyboardControlReply rep;
+ xGetKeyboardControlReply rep = {0};
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1492,7 +1490,7 @@ int
ProcGetPointerControl(ClientPtr client)
{
register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
- xGetPointerControlReply rep;
+ xGetPointerControlReply rep = {0};
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1526,7 +1524,7 @@ ProcGetMotionEvents(ClientPtr client)
{
WindowPtr pWin;
xTimecoord * coords = (xTimecoord *) NULL;
- xGetMotionEventsReply rep;
+ xGetMotionEventsReply rep = {0};
int i, count, xmin, xmax, ymin, ymax;
unsigned long nEvents;
DeviceIntPtr mouse = inputInfo.pointer;
@@ -1591,7 +1589,7 @@ ProcGetMotionEvents(ClientPtr client)
int
ProcQueryKeymap(ClientPtr client)
{
- xQueryKeymapReply rep;
+ xQueryKeymapReply rep = {0};
int i;
CARD8 *down = inputInfo.keyboard->key->down;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index e59144f..dba734a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
@@ -361,7 +361,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
int nnames;
int stringLens;
int i;
- xListFontsReply reply;
+ xListFontsReply reply = {0};
char *bufptr;
char *bufferStart;
int aliascount = 0;
@@ -602,13 +602,12 @@ finish:
for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
- memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply;
reply.length = (stringLens + nnames + 3) >> 2;
reply.nFonts = nnames;
reply.sequenceNumber = client->sequence;
- bufptr = bufferStart = (char *) malloc(reply.length << 2);
+ bufptr = bufferStart = (char *) calloc(1, reply.length << 2);
if (!bufptr && reply.length) {
SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
@@ -744,7 +743,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
xFontProp *pFP;
int i;
int aliascount = 0;
- xListFontsWithInfoReply finalReply;
+ xListFontsWithInfoReply finalReply = {0};
if (client->clientGone)
{
@@ -967,7 +966,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
}
finish:
length = sizeof(xListFontsWithInfoReply);
- bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply));
finalReply.type = X_Reply;
finalReply.sequenceNumber = client->sequence;
finalReply.length = (sizeof(xListFontsWithInfoReply)
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list