diff options
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 70 |
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); } } } |