aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-07-03 16:20:55 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-07-03 16:20:55 +0200
commitce83b566a276797120cef5dc0269309907ba612f (patch)
treee6c9306dac6aef428ab37e678c690f63856c48ba /nx-X11/programs/Xserver/hw
parent9834951239bbbfb24dfc919b7e321e21e14d3222 (diff)
parentb394eac8f79773dbe8e40f62e2aeb5c49bf7f65d (diff)
downloadnx-libs-ce83b566a276797120cef5dc0269309907ba612f.tar.gz
nx-libs-ce83b566a276797120cef5dc0269309907ba612f.tar.bz2
nx-libs-ce83b566a276797120cef5dc0269309907ba612f.zip
Merge branch 'uli42-pr/misc' into 3.6.x
Attributes GH PR #712: https://github.com/ArcticaProject/nx-libs/pull/712
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c33
2 files changed, 18 insertions, 23 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 758ec9275..51a11b4f4 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -704,7 +704,7 @@ int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff)
int mapWidth;
int min_keycode, max_keycode;
KeySymsRec keySyms;
- CARD8 modmap[256];
+ CARD8 modmap[MAP_LENGTH];
int i, j;
XKeyboardState values;
char *model = NULL, *layout = NULL;
@@ -765,7 +765,7 @@ N/A
#ifdef _XSERVER64
{
KeySym64 *keymap64;
- int i, len;
+ int len;
keymap64 = XGetKeyboardMapping(nxagentDisplay,
min_keycode,
max_keycode - min_keycode + 1,
@@ -807,8 +807,7 @@ N/A
nxagentCapsMask = 0;
nxagentNumlockMask = 0;
- for (i = 0; i < 256; i++)
- modmap[i] = 0;
+ memset(modmap, 0, sizeof(modmap));
for (j = 0; j < 8; j++)
for(i = 0; i < modifier_keymap->max_keypermod; i++) {
CARD8 keycode;
@@ -823,6 +822,7 @@ N/A
}
}
XFreeModifiermap(modifier_keymap);
+ modifier_keymap = NULL;
nxagentCheckRemoteKeycodes();
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index e59144f94..50bf719c6 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;
@@ -478,7 +478,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
return TRUE;
}
if (err == FontNameAlias) {
- if (resolved) free(resolved);
+ free(resolved);
resolved = (char *) malloc(resolvedlen + 1);
if (resolved)
memmove(resolved, tmpname, resolvedlen + 1);
@@ -544,8 +544,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
{
c->saved = c->current;
c->haveSaved = TRUE;
- if (c->savedName)
- free(c->savedName);
+ free(c->savedName);
c->savedName = (char *)malloc(namelen + 1);
if (c->savedName)
memmove(c->savedName, name, namelen + 1);
@@ -602,13 +601,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);
@@ -664,14 +662,14 @@ bail:
for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]);
free(c->fpe_list);
- if (c->savedName) free(c->savedName);
+ free(c->savedName);
#ifdef HAS_XFONT2
xfont2_free_font_names(names);
#else
FreeFontNames(names);
#endif /* HAS_XFONT2 */
free(c);
- if (resolved) free(resolved);
+ free(resolved);
return TRUE;
}
@@ -691,7 +689,7 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
if (length > XLFDMAXFONTNAMELEN)
return BadAlloc;
- if (!(c = (LFclosurePtr) malloc(sizeof *c)))
+ if (!(c = (LFclosurePtr) calloc(1, sizeof *c)))
return BadAlloc;
c->fpe_list = (FontPathElementPtr *)
malloc(sizeof(FontPathElementPtr) * num_fpes);
@@ -744,7 +742,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
xFontProp *pFP;
int i;
int aliascount = 0;
- xListFontsWithInfoReply finalReply;
+ xListFontsWithInfoReply finalReply = {0};
if (client->clientGone)
{
@@ -857,8 +855,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
c->saved = c->current;
c->haveSaved = TRUE;
c->savedNumFonts = numFonts;
- if (c->savedName)
- free(c->savedName);
+ free(c->savedName);
c->savedName = (char *)malloc(namelen + 1);
if (c->savedName)
memmove(c->savedName, name, namelen + 1);
@@ -967,7 +964,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)
@@ -985,7 +981,7 @@ bail:
FreeFPE(c->fpe_list[i]);
free(c->reply);
free(c->fpe_list);
- if (c->savedName) free(c->savedName);
+ free(c->savedName);
free(c);
return TRUE;
}
@@ -1203,7 +1199,7 @@ nxdoListFontsAndAliases(client, fss)
return TRUE;
}
if (err == FontNameAlias) {
- if (resolved) free(resolved);
+ free(resolved);
resolved = (char *) malloc(resolvedlen + 1);
if (resolved)
{
@@ -1275,8 +1271,7 @@ nxdoListFontsAndAliases(client, fss)
{
c->saved = c->current;
c->haveSaved = TRUE;
- if (c->savedName)
- free(c->savedName);
+ free(c->savedName);
c->savedName = (char *)malloc(namelen + 1);
if (c->savedName)
{
@@ -1372,7 +1367,7 @@ finish:
for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]);
free(c->fpe_list);
- if (c->savedName) free(c->savedName);
+ free(c->savedName);
#ifdef HAS_XFONT2
xfont2_free_font_names(c->names);
#else
@@ -1380,7 +1375,7 @@ finish:
#endif /* HAS_XFONT2 */
free(c);
free(fss);
- if (resolved) free(resolved);
+ free(resolved);
return doOpenFont(client, oc);
}