aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2016-11-08 08:00:44 +0100
committerMihai Moldovan <ionic@ionic.de>2016-11-08 08:00:44 +0100
commitb1d3f2ca5552528c01eefce7e55c18c36965660d (patch)
tree546ee82fe70cf9af80dc80598fde106a0687de46 /nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
parent7b79e8d831a520624fd5e28be6da7c6ad3360c1a (diff)
parent2f2ade61a8823bad012737b2b388dcc168cccbbf (diff)
downloadnx-libs-b1d3f2ca5552528c01eefce7e55c18c36965660d.tar.gz
nx-libs-b1d3f2ca5552528c01eefce7e55c18c36965660d.tar.bz2
nx-libs-b1d3f2ca5552528c01eefce7e55c18c36965660d.zip
Merge branch 'uli42-pr/keyboard_fixes' into arctica-3.6.x
Attributes GH PR #243: https://github.com/ArcticaProject/nx-libs/pull/243
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Reconnect.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index c20386ea1..65e2ae795 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -438,22 +438,14 @@ Bool nxagentReconnectSession(void)
if (nxagentKeyboard != NULL)
{
- int size;
-
- size = strlen(nxagentKeyboard);
-
- if ((nxagentOldKeyboard = malloc(size + 1)) != NULL)
+ nxagentOldKeyboard = strndup(nxagentKeyboard, strlen(nxagentKeyboard));
+ if (nxagentOldKeyboard == NULL)
{
- strncpy(nxagentOldKeyboard, nxagentKeyboard, size);
-
- nxagentOldKeyboard[size] = '\0';
+ /* 0 means reconnection failed */
+ return 0;
}
- }
- if (nxagentKeyboard)
- {
free(nxagentKeyboard);
-
nxagentKeyboard = NULL;
}