aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-07-22 21:34:42 +0200
committerUlrich Sibiller <uli42@gmx.de>2019-08-06 21:57:32 +0200
commitfd4fa4e9646bb3f5a9091dc571b158a861b6127e (patch)
treeea077827e80e37fc4a84552b9736eb45dbd3d747 /nx-X11/programs/Xserver
parent156533439445173e488d648354a94103f578cfa0 (diff)
downloadnx-libs-fd4fa4e9646bb3f5a9091dc571b158a861b6127e.tar.gz
nx-libs-fd4fa4e9646bb3f5a9091dc571b158a861b6127e.tar.bz2
nx-libs-fd4fa4e9646bb3f5a9091dc571b158a861b6127e.zip
Keyboard.c: use SAFE_XFree and SAFE_free
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 6fbc66481..b7ed38ca3 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -58,6 +58,7 @@ is" without express or implied warranty.
#include "Options.h"
#include "Error.h"
#include "Init.h"
+#include "Utils.h"
#include "compext/Compext.h"
@@ -657,7 +658,7 @@ N/A
{
keymap[i] = keymap64[i];
}
- XFree(keymap64);
+ SAFE_XFree(keymap64);
}
#else /* #ifdef _XSERVER64 */
@@ -762,7 +763,7 @@ XkbError:
#ifdef TEST
fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__);
#endif
- free(nxagentKeyboard);
+ SAFE_free(nxagentKeyboard);
nxagentKeyboard = strdup("clone");
}
@@ -809,7 +810,7 @@ XkbError:
layout = strdup(strsep(&tmp, sep));
variant = strdup(strsep(&tmp, sep));
options = strdup(strsep(&tmp, sep));
- free(rmlvo);
+ SAFE_free(rmlvo);
}
else
{
@@ -864,11 +865,11 @@ XkbError:
/* Only setup keycode conversion if we are NOT in clone mode */
if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0))
{
- free(rules); rules = strdup(nxagentRemoteRules);
- free(model); model = strdup(nxagentRemoteModel);
- free(layout); layout = strdup(nxagentRemoteLayout);
- free(variant); variant = strdup(nxagentRemoteVariant);
- free(options); options = strdup(nxagentRemoteOptions);
+ SAFE_free(rules); rules = strdup(nxagentRemoteRules);
+ SAFE_free(model); model = strdup(nxagentRemoteModel);
+ SAFE_free(layout); layout = strdup(nxagentRemoteLayout);
+ SAFE_free(variant); variant = strdup(nxagentRemoteVariant);
+ SAFE_free(options); options = strdup(nxagentRemoteOptions);
/*
* when cloning we do not want X2Go to set the keyboard
* via a keyboard file generated by nxagent. The defined
@@ -947,9 +948,9 @@ XkbError:
NXShadowInitKeymap(&(pDev->key->curKeySyms));
}
- free(rules);
- free(variant);
- free(options);
+ SAFE_free(rules);
+ SAFE_free(variant);
+ SAFE_free(options);
}
if (xkb)
@@ -958,8 +959,8 @@ XkbError:
xkb = NULL;
}
- free(model);
- free(layout);
+ SAFE_free(model);
+ SAFE_free(layout);
#endif
#ifdef WATCH
@@ -980,9 +981,9 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#endif
#ifdef _XSERVER64
- free(keymap);
+ SAFE_free(keymap);
#else
- XFree(keymap);
+ SAFE_XFree(keymap);
#endif
break;
case DEVICE_ON:
@@ -1182,7 +1183,7 @@ int nxagentResetKeyboard(void)
nxagentFreeKeyboardDeviceData(devBackup);
- free(devBackup);
+ SAFE_free(devBackup);
return 1;
}
@@ -1315,18 +1316,15 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
}
#endif
- free(dev->key->curKeySyms.map);
- free(dev->key->modifierKeyMap);
- free(dev->key);
-
- dev->key = NULL;
+ SAFE_free(dev->key->curKeySyms.map);
+ SAFE_free(dev->key->modifierKeyMap);
+ SAFE_free(dev->key);
}
if (dev->focus)
{
- free(dev->focus->trace);
- free(dev->focus);
- dev->focus = NULL;
+ SAFE_free(dev->focus->trace);
+ SAFE_free(dev->focus);
}
if (dev->kbdfeed)
@@ -1338,7 +1336,7 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
if (k->xkb_sli)
XkbFreeSrvLedInfo(k->xkb_sli);
#endif
- free(k);
+ SAFE_free(k);
}
dev->kbdfeed = NULL;
}
@@ -1571,11 +1569,11 @@ void nxagentTuneXkbWrapper(void)
void nxagentXkbClearNames(void)
{
- free(nxagentRemoteRules); nxagentRemoteRules = NULL;
- free(nxagentRemoteModel); nxagentRemoteModel = NULL;
- free(nxagentRemoteLayout); nxagentRemoteLayout = NULL;
- free(nxagentRemoteVariant); nxagentRemoteVariant = NULL;
- free(nxagentRemoteOptions); nxagentRemoteOptions = NULL;
+ SAFE_free(nxagentRemoteRules);
+ SAFE_free(nxagentRemoteModel);
+ SAFE_free(nxagentRemoteLayout);
+ SAFE_free(nxagentRemoteVariant);
+ SAFE_free(nxagentRemoteOptions);
}
static void nxagentXkbGetNames(void)
@@ -1618,7 +1616,7 @@ static void nxagentXkbGetNames(void)
{
if (data)
{
- XFree(data);
+ SAFE_XFree(data);
return;
}
}
@@ -1655,7 +1653,7 @@ static void nxagentXkbGetNames(void)
name += strlen(name) + 1;
}
- XFree(data);
+ SAFE_XFree(data);
return;
}
@@ -1686,12 +1684,12 @@ static char* getKeyboardFilePath(void)
{
if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1))
{
- free(sessionpath);
+ SAFE_free(sessionpath);
FatalError("malloc for keyboard file path failed.");
}
else
{
- free(sessionpath);
+ SAFE_free(sessionpath);
}
}
else
@@ -1720,7 +1718,7 @@ static void nxagentWriteKeyboardDir(void)
{
fprintf(stderr, "Info: keyboard blocking directory created: '%s'\n", keyboard_file_path);
}
- free(keyboard_file_path);
+ SAFE_free(keyboard_file_path);
}
}
@@ -1748,7 +1746,7 @@ static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, cha
int save_err = errno;
fprintf(stderr, "Error: keyboard file not created: %s\n", strerror(save_err));
}
- free(keyboard_file_path);
+ SAFE_free(keyboard_file_path);
}
}
}