diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-01-03 02:34:10 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2018-01-07 01:27:07 +0100 |
commit | b89b8094934856ae2f2b0e3bca83d3fe171f87b9 (patch) | |
tree | 3e492a14f8a41862130b49f0d9f2885ee7166ea7 /nx-X11/programs | |
parent | 27a31d0ce3abc533b7e88932667a4b84e838dbff (diff) | |
download | nx-libs-b89b8094934856ae2f2b0e3bca83d3fe171f87b9.tar.gz nx-libs-b89b8094934856ae2f2b0e3bca83d3fe171f87b9.tar.bz2 nx-libs-b89b8094934856ae2f2b0e3bca83d3fe171f87b9.zip |
Error.c: replace malloc+strcpy by strdup
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Error.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c index 7abd83ae3..f5fb297b3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Error.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c @@ -524,6 +524,7 @@ char *nxagentGetSessionPath(void) return NULL; } + /* FIXME: necessary? */ snprintf(nxagentSessionDir, DEFAULT_STRING_LENGTH, "%s", rootPath); if (strlen(nxagentSessionDir) + strlen("/C-") + strlen(nxagentSessionId) > DEFAULT_STRING_LENGTH - 1) @@ -562,9 +563,9 @@ char *nxagentGetSessionPath(void) } - sessionPath = malloc(strlen(nxagentSessionDir) + 1); + sessionPath = strdup(nxagentSessionDir); - if (sessionPath == NULL) + if (sessionPath == NULL) { #ifdef PANIC fprintf(stderr, "nxagentGetSessionPath:: PANIC! Can't allocate memory for the session path.\n"); @@ -573,9 +574,6 @@ char *nxagentGetSessionPath(void) return NULL; } - - strcpy(sessionPath, nxagentSessionDir); - return sessionPath; } |